Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install and use sqlobject+mysql on iron python?

Is it possible to use sqlobject to connect to a mysql database from iron python? If so, how? What must I install?

I have sqlobject installed for cpython and it works fine, but if I use that same package in ironpython I get "ImportError: No module named _mysql". I understand this to mean that ironpython cannot load the C-based .dlls necessary to access the mysql API. What's the workaround, or is there one?

like image 753
Bryan Oakley Avatar asked Aug 03 '12 20:08

Bryan Oakley


1 Answers

Looking at the source code sqlobject is pure python, the code is depended on MySQLdb which is restricted to cpython.

However if you modify the code to use mysql.connector (http://dev.mysql.com/doc/connector-python/en/index.html) library which is written in pure python you should be able to estanblish a connection to mysql

Note: That mysql.connector doesn't follow the same api as MySQLdb and will require considerable amount of rewrite to the source code

I believe this may be your best workaround

like image 64
AbsoluteMSTR Avatar answered Nov 03 '22 11:11

AbsoluteMSTR