This post originated from an RSS feed registered with Python Buzz
by Andrew Dalke.
Original Post: databases
Feed Title: Andrew Dalke's writings
Feed URL: http://www.dalkescientific.com/writings/diary/diary-rss.xml
Feed Description: Writings from the software side of bioinformatics and chemical informatics, with a heaping of Python thrown in for good measure.
Accessing a SQL database with Python is very simple. There are Python
modules that interface to most database servers. All of those
implement a standard API which
makes it easy to port from one database to another. (Though each
database has its own nuances and sticky points.) There are tutorials and
many people know how to use it so you can ask questions on the comp.lang.python newsgroup or read
recipes (how-tos).
Because of the standard API there are libraries like SQLObject to do object-relation
mapping on top of an existing SQL database. There are even several self-contained SQL libraries if you
don't want to run a server.
If you decide to use a relational database, the best Oracle client for
Unix is cx_Oracle and
the best Windows ODBC solution is mxODBC.
If you don't like relational databases you can use an object database
instead. Again there are several, including ZODB and Durus. I've
used ZODB for several projects where I had to store lots of different
data types and didn't need fast searching.
The options are almost overwhelming. This should help simplify your
decisions:
If you have reasonably well-defined data and/or want multiple languages to connect to the database, use Oracle, MySQL or PostgreSQL
If you are mostly dealing with Python and want a relational
database backend then use SQLObject on top of one of those listed SQL
databases
If you don't need a server now but might in the future (for
performance, perhaps) then use one of the server-free SQL libraries
like SQLLite.
If you have a lot of Python objects and/or complex data structure
that you want to manipulate as a data structure, use ZODB or another
object database.
If your data is well-structured and simple and you don't need a
server, use BerkeleyDB.