Is Python any good with MySQL?
Alex Martelli
aleaxit at yahoo.com
Mon Nov 6 08:23:18 EST 2000
"Keith MacDonald" <keith at nojunk.textpad.com> wrote in message
news:fpwN5.6470$Fi.20998 at NewsReader...
> I've been successfully using Perl for web site development, but don't
really
> like it, as it is so baroque. All the different ways it has to achieve
the
> same ends makes it very difficult to follow anyone elses code. It
certainly
> isn't self-documenting!
>
> At first inspection, Python seems a much cleaner language, but I'm
> disappointed about its lack of inbuilt support for databases. This is
such
> a fundamental requirement nowadays that it is worrying that it has been
left
> to 3rd party add-ons. I need to be able to get up and running quickly, on
Is Perl any different in this regard? I don't think so! Both
Perl and Python include built-in support for 'dbm'-style databases,
and specify standard API's for interfacing to relational databases
but leave the implementation of those API's to add-on modules
("3rd party" ones, in a sense).
Regarding Python/MySQL specifically, I have no direct experience,
but clearly one possibility is MySQLdb:
http://dustman.net/andy/python/MySQLdb/0.3.0
(the following URL...:
http://www.faqts.com/knowledge-base/view.phtml/aid/4188/fid/395/lang/
points to a pre-built Windows binary of this module, in case you
lack a compiler on Windows to build the binary from sources),
and there are others.
> Before I give in and go back to Perl, would anyone care to reassure me
that
> Python really is suitable for web site development with MySQL, and point
me
> at some documentation which will help me get started?
The docs at, e.g.,
http://www.biostat.washington.edu/biostat/computing/DebDocs/python-mysqldb/M
ySQLdb.html
seem reasonably good although concise; but, as they themselves
say, "The DB API specification should be your primary guide for using
this module", and they link you to
http://www.python.org/topics/database/DatabaseAPI-2.0.html
which is a detailed reference of the standard Python DB API,
release 2.0 (the MySQLdb specific docs don't repeat that,
they just give version-specific supplementary info!).
You'll find some simple examples of Python DB API use at
http://starship.python.net/crew/amk/python/writing/DB-API.html
and it shouldn't be hard to use them to try out any DB API
compliant module.
Alex
More information about the Python-list
mailing list