MySQL Connector/Python v1.0.5 beta available for download

MySQL Connector/Python v1.0.5 beta is now available for download from the MySQL website. This version is feature complete and we welcome and appreciate feedback and bug reports.

We’re also interested in hearing your feedback for future enhancements. Let us know how you’re using the connector too, especially if you are using it with Django, SQLAlchemy and similar Python technologies.

A few things have changed since the last development releases and we hope the manual shipping with the Connector/Python distribution (and also available online soon) will help you get up to speed.

Here are a few important changes that might be incompatible with current scripts using the now obsolete development releases v0.3.2 and earlier:

  • MySQLCursor.execute() returns None. When multiple statements are send, it will return a generator object.
  • MySQLConnection.ping() raises and exception. The is_connected() method will return True or False.
  • The following methods of MySQLConnection changed: set_charset() replaced by set_charset_collation(); unset_client_flag() and set_client_flag() are removed, use set_client_flags() instead.

There have been quite a few changes and bug fixes. I recommend checking the ChangeLog file in the distribution of MySQL Connector/Python, and, once available, also the change log in the MySQL manual.

You can download Connector/Python 1.0.5-beta at:

If you’d like to ask questions or seek advice in using the connector, check out the following MySQL forum:

Comments

Fizyk
How is it compared to MySQLdb?

We’ve been using this library so far, on mysql 5.1, and with sqlalchemy

Geert Vanderkelen
Connector/Python 1.0 will work with SQLAlchemy once the dialect is updated.

But Connector/Python is pure Python and does not need any other MySQL software, thus no C libraries and compiling.

Fizyk
So… not ready yet? I’m looking for mysqldb replacement, since this library seems to no longer be maintaned, and latest release is about 5 years old ;)

I’ve found your old status report: http://geert.vanderkelen.org/status-report-no-2-on-sqlalchemy-and-mysql-connectorpython/

And I think I will have to do some testing with all three libraries ;)

s7v7nislands
https://launchpad.net/myconnpy

why don’t update this project?

Geert Vanderkelen
Everything has its time, but we will update Launchpad.
Geert Vanderkelen
Thanks for checking it out! I will try to follow up on that old post.
David McNelis
The removal of set_client_flag doesn’t jive well in SqlAlchemy 0.7. It wants to run set_client_flag recursively.
David McNelis
One more thing. SQLAlchemy was looking for get_characterset_info(). I was able to get everything working without any blatant issues with the following (which is hacky.. but I needed it to work right now). Fwiw, I’m running SQLAlchemy 0.7, MySQL 5.1 and needed to support SSL connections to the db… they seem to be working just fine.

[python] def get_characterset_info(self, **kwargs): pass

def set_client_flag(self, flags): return self.set_client_flags(flags) [/python]

(Updated by Geert: Showing Python code better)

Geert Vanderkelen
Thanks so much for trying out the beta of Connector/Python with SQLAlchemy!

The best way would be to update the dialect of SQLAlchemy: lib/sqlalchemy/dialects/mysql/mysqlconnector.py

[python] def _get_server_version_info(self, connection): .. from mysql.connector.constants import ClientFlag dbapi_con.set_client_flags([ClientFlag.FOUND_ROWS]) .. [/python]

Although I’m not sure why the client flags have to be set there. And:

[python] def _detect_charset(self, connection): return connection.connection.charset [/python]

There seems to be not much to change in the dialect, which is a good thing :) (Above code is not tested, but should be good start)

David McNelis
Thanks a ton, Geert!