MySQL access from Python
echuck at mindspring.com
Thu Mar 2 04:05:28 CET 2000
Andy Dustman wrote:
> One weird/interesting thing it does is it lets you specify how values are
> converted going from MySQL to Python and vice versa. There are two
> dictionaries that key on types, which map to functions which do the
> conversion, with sensible default conversions. (MySQL actually returns all
> values to the C API as strings, and all values passed to MySQL must be
> part of a literal query string.)
That's a really nice feature actually. It lets me use my custom DateTime class and deal with more esoteric types however I want.
> 0.1.2 is the current version. I have reports that it dumps core on
> RedHat/Alpha platforms, but I can't reproduce it on RedHat/Intel; patches
> welcome. 0.1.1 doesn't have this problem, and it's still available in the
> same location (no direct link on the page, however). Other people have
> reported getting it to work on that crackpot OS from out of Redmond. It
> also includes a patch to make Zope's ZMySQLDA to work with it instead of
> MySQLmodule. Also check this page:
Hmm, sounds like yours isn't stable and if MySQLmodule isn't current and/or supported that for production purposes, this is kind of scary.
> I haven't looked at MySQLmodule a whole lot lately. Here's what I THINK I
> know about it, some of which may be wrong:
> - Doesn't give up the interpreter lock during blocking calls, causing
> threads to block (bad for threaded things like Zope).
> - MySQL-3.21 compatible only.
Not sure about that. It works in my preliminary tests, but admittedly I haven't done much with it. I did have to tweak the code to get it to compile--not a good sign.
> - Also a split interface (C module + Python wrapper).
> - The C module exports a Perl-style interface (ick).
Looking at the features, it seemed more "friendly" than Python's DB API in that some things were more explicit. For example, you could ask for a list of columns for a given table. I'm sure you can do that type of thing in SQL, but SQL does vary per server and it was nice to have some higher-level functions rather than just basically the infamous "execute this SQL" function.
What do you think?
> - Not really actively supported. Joe Skinner (original MySQLmodule author)
> has expressed optimism that he might finally stop getting bugged about
> MySQLmodule. :)
Looks like "Joerg Senekowitsch (senekow at ibm.net)" is the latest author, but that e-mail address bounces now. Perhaps he was getting bugged too much. :-)
More information about the Python-list