My family end 2010

2009 was a special year, but 2010 top it: marrying Marta and the birth of our son Tomas. I have what I wished for, now I know who and what to work for.

By |December 20th, 2010|Personal|1 Comment|

MySQL v5.5 and Python

MySQL v5.5 is GA, but is it working with Python? Yes, it does. Below you’ll find some quick, small tests I did with MySQLdb, oursql and our own MySQL Connector/Python.

My desktop is a Mac, but when it works on that, I’m sure it works elsewhere too. If not, just let us know!

MySQL for Python (aka MySQLdb)

Installing MySQL v5.5.8 64-bit from tar ball on MacOS X 10.6, it compiled fine and the module loaded giving me the expected result:

>>> import MySQLdb
>>> cnx = MySQLdb.connect(user='root')
>>> cur = cnx.cursor()
>>> cur.execute("SELECT VERSION()")
1L
>>> print cur.fetchall()
(('5.5.8',),)

oursql

oursql is an alternative for MySQLdb. Both are using the MySQL C API and thus need to be compiled from source (if you don’t find binaries of course).

>>> import oursql
>>> cnx = oursql.connect(user='root')
>>> cur = cnx.cursor()
>>> cur.execute("SELECT VERSION()")
>>> print cur.fetchall()
[(u'5.5.8',)]

MySQL Connector/Python

Our own MySQL Connector/Python doesn’t need compiling and doesn’t need any MySQL software installed to be able to connect to a MySQL server. Current unittests run fine against MySQL v5.5.8.

>>> cnx = mysql.connector.connect(user='root')
>>> cur = cnx.cursor()
>>> cur.execute("SELECT VERSION()")
-1
>>> print cur.fetchall()
[(u'5.5.8',)]

Conclusion

One can’t really conclude anything with the simple tests above, but it looks like MySQL v5.5 will work fine with Python.

This blog served by MySQL v5.5

MySQL v5.5 is GA and my blog, using WordPress 3.0, runs on it.

My personal highlight of this new MySQL version? The fact that it is released by Oracle.

MySQL Connector/Python 0.3.0 has been released!

MySQL Connector/Python 0.3.0, a development release, is available for download:
https://launchpad.net/myconnpy/+download

Since version 0.3.0 is still a development release, or ‘alpha’, it is not
recommended to run this in production.

MySQL Connector/Python 0.3.0 adds following features:

  • Python v2.4 support is back.
  • Support for compressed protocol.
  • Support for SSL connections (when Python’s ssl module is available).
  • Support for packets which are bigger than 16MB.
  • Max allowed packetsize defaults to 1GB.
  • Some performance improvements.

See the ChangeLog for extra details.

Please report bugs and comments using the bug tracker on Launchpad:
https://bugs.launchpad.net/myconnpy

About MySQL Connector/Python: MySQL Connector/Python is implementing the
MySQL Client/Server protocol completely in Python. No MySQL libraries
are needed, and no compilation is necessary to run this Python DB API v2.0
compliant driver. It is compatible with Python v2.4 and later as well as
Python v3.1 and later.