This module should be mostly compatible with an older interface written by Joe Skinner and others. However, the older version is a) not thread-friendly (database operations could cause all other threads to block), b) written for MySQL 3.21 (does not compile against newer versions without patches), c) apparently not actively maintained. MySQLdb is a completely new module, distributed free of charge under a license derived from the Python license.
This module is developed on RedHat Linux 5.2 for Intel. It should build without
much trouble on most UNIX-like platforms by using the
Windows is not a supported platform.
reportedly gets the job done, probably just on NT, maybe others.
MySQLdb requires Python 1.5.2. Earlier versions will not work, because
support for C
long long is required by MySQL. If you have an
earlier version of Python, upgrade to 1.5.2 or beyond.
Only versions 3.22.32 and up are guaranteed to work. Some older versions may work; if you have an older version you should seriously consider upgrading to get the bug fixes and particularly the security updates.
MySQL-3.22 seems to have a problem trying to insert
values with fractional seconds. Values like 12:56:13.00 are
returned as 344:13:00, apparently interpreting the original input
as 12 days, 56 hours, 13 minutes, 0 seconds. (12 days and 56 hours
is 344 hours.) To avoid this problem, use the
MySQLdb has only been lightly tested. MySQL-3.23 is presently in alpha (unstable) release. Several API additions have been made so far. These will be incorporated into MySQLdb as work progresses.
If you have the DateTime module installed (recommended), MySQLdb will use it for date-related objects. Otherwise, these will be returned to Python as strings. You can also modify the type conversion dictionaries to return these as other object classes, if you prefer.
MySQLmodule, the older MySQL interface by Joe Skinner and others,
is also a split C/Python
MySQL, the C portion, has an interface similar to
perl's DBI internally. In addition, there is Python portion,
which provides a DB API v1.0 interface, written by James Henstridge.
In contrast, MySQLdb's C portion,
, is designed
to mimic the MySQL C API in an object-oriented way; you should not
expect to move from
_mysql without a fair amount of
provides a DB API v2.0 interface,
which has some changes from the v1.0 interface. Things to watch out
for in particular:
|Connecting|| || |
|Implicit cursor|| ||implicit cursors dropped from DB API v2.0; always use |
|Fetch row as dictionary|| ||not standard; alternate cursor class |
|Transactions|| || |
The distribution contains a patch to modify the Zope ZMySQLDA to use MySQLdb instead of MySQLmodule. Read the instructions in the patch. If that fails, read the FAQ.
The web page documentation may be slightly ahead of the latest release and may reflect features of the next release.
A FAQ is available at http://dustman.net/andy/python/MySQLdb-FAQ.html.