Geert JM Vanderkelen

Small status on SQLAlchemy and MySQL Connector/Python

Small status on SQLAlchemy and MySQL Connector/Python

Using SQLAlchemy unit test cases to further develop MySQL Connector/Python. It’s probably debatable whether that’s a good method or just lame. But it sure helps lots!

We’ve been pushing some code past days that makes Connector/Python almost pass all tests. Well, 4% is still failing, but I’m confident that in a few most problems will be dealt with. I had to make some changes to the SQLAlchemy v0.6 dialect as well, and some test cases had to be corrected. Hopefully those corrections will also go in the SQLAlchemy trunk later on.

shell> nosetests --dburi=mysql+mysqlconnector://root:@localhost/sqlalchemy
Ran 2092 tests in 314.656s

FAILED (errors=72, failures=11)

If you run the same tests against MySQLdb, you’ll see (of course) less failures (9 to be exact).

6 thoughts on “Small status on SQLAlchemy and MySQL Connector/Python

  1. Aigars Mahinovs

    Not preparred statements, but having the cursor that will only fetch results from the server to the client on a per-line basis as they are needed. The current Mysql-python has SSCursor for that. The idea that if you are doing a huge select that will return 5 Gb of data in total, you do not want to download the whole result set to the client side at one, instead the results are stored on the server and are transfered to the client one-by-one while the client software iterates over the result cursor.

  2. Geert JM Vanderkelen

    @Aigars: Sorry, I miss understood your first question.

    However, MySQLdb SSCursor is doing what MySQL Connector/Python is doing by default. We are not fetching the result right away, the programmer needs to fetch it. We call this 'unbuffered'.
    Do mimic what MySQLdb is doing by default: mysql.connector.connect(buffered=True)

    I hope this helps.
    Don't hesitate to take the question to

  3. Mark Huang


    I’m wondering what’s the status of this? Can Connector/Python work with SQLAlchemy?

    I’m having trouble using/installing python-mysql so I was hoping using this would work. I am working on Pylons.

  4. Geert Vanderkelen Post author

    @Mark Huang
    MySQL Connector/Python changed a bit, and the dialect coming with SQLAlchemy 0.6 (!) is probably going to need some updating.
    As far as I know, Pylons is using SQLAlchemy 0.5, which doesn’t work with MySQL Connector/Python.
    I hope you get that MySQLdb going meanwhile.

Leave a Reply

Your email address will not be published. Required fields are marked *

9 + 1 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>