databases
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.
Or you can try out Sleepycat's BerkeleyDB.
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.
Andrew Dalke is an independent consultant focusing on software development for computational chemistry and biology. Need contract programming, help, or training? Contact me
Copyright © 2001-2020 Andrew Dalke Scientific AB