views:

161

answers:

2

Does there exist, or is there an intention to create, a universal database frontend for Python like Perl's DBI? I am aware of Python's DB-API, but all the separate packages are leaving me somewhat aggravated.

+1  A: 

Well...DBAPI is that frontend:

This API has been defined to encourage similarity between the Python modules that are used to access databases. By doing this, we hope to achieve a consistency leading to more easily understood modules, code that is generally more portable across databases, and a broader reach of database connectivity from Python.

It has always worked great for me atleast, care to elaborate the problems you are facing?

truppo
It's not a frontend; it's an API for one. I'm looking for a module.
BipedalShark
I don't really have a "problem" in the sense of having a project that uses more than one database engine. I've been experimenting with the different engines, though, and find downloading, installing, and dealing with multiple documentation sets (none of the modules follow the API perfectly) a little cumbersome.
BipedalShark
+3  A: 

AFAIK there is no one Python module that implements the DB-API to multiple databases and that's pretty much by design: why bring in unneeded functionality and possibly require the underlying database libraries to be installed if you are not going to use them? You can argue with that design decision but that's the way it is. On the other hand, the DB-API attempts to ensure that the API presented by the individual DB adapters is the same (or very close to the same). And then there are ORM modules, like SQLAlchemy that provide a much higher-level abstraction layer. They still require the lower-level DB-API modules, though.

Note, as of 2.5, the Python standard library does include an SQLite3 DB-API, i.e. batteries included.

Ned Deily
+1 to sqlalchemy
nosklo
Even if you don't use the ORM, stuff like create_engine http://www.sqlalchemy.org/docs/05/sqlexpression.html#connecting and friends are very helpful for making connecting to different dbs pretty seamless. Of course you have to install pycopg2 and friends for the last mile, as you point out.
Gregg Lind