MySQL access from Python

Andy Dustman adustman at comstar.net
Thu Mar 2 13:40:29 EST 2000


On Wed, 1 Mar 2000, Chuck Esterbrook wrote:

> Andy Dustman wrote:
> 
> > 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 still consider 0.1.2 to be slightly beta; 0.0.x was alpha, 0.1.x is
beta. The core dumps ONLY occur on Alpha, for unknown reasons; there are
no known problems on Intel. There are apparently a couple of Zope sites
that use MySQLdb in production. I've heard that www.codecatalog.com is one
of these, but can't confirm this.
 
> 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?

Hard to say. MySQLdb generally exports most of the MySQL-specific calls
that _mysql has for completeness. So you can do stuff like this (db is a
Connection object):

fields = db.list_fields(table) # returns list of fields as tuple

This is non-portable, of course. Then again, the SQL to do the same thing
is probably also non-portable.

MySQLdb has also been throughly tested against memory leaks when running
multiple threads. If you need threads (for Zope or otherwise), this is
the only real choice.

-- 
andy dustman       |     programmer/analyst     |      comstar.net, inc.
telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d
"Therefore, sweet knights, if you may doubt your strength or courage, 
come no further, for death awaits you all, with nasty, big, pointy teeth!"




More information about the Python-list mailing list