[DB-SIG] perl-DBI like module for Python?

Mihai Ibanescu misa at redhat.com
Mon May 24 11:57:14 EDT 2004


Hello,

I am not sure if it was mentioned before on this list.
Is there a module that does what the perl DBI module does?
What I mean by that is: a top-level module that exposes the API defined in the
DB API document, but with the ability to change backend drivers on the fly.

Example: I have my application running against Postgres. I have to be able to
port it to Oracle too. Unfortunately, code that tries to catch
DatabaseException will have to look for the cx_Oracle DatabaseException, not
for the postgres one.

This would be easily solved if a DBI module would provide the base classes
(for things like Database, Cursor, DatabaseException etc.) that the code could
use, and a connect function that could specify the database driver to use
(postgres, cx_Oracle etc). Drivers would inherit their classes from this
top-level module. 

jdbc/odbc do the same thing.

Is there such a thing out there?

Thanks,
Misa (re-inventing the wheel)



More information about the DB-SIG mailing list