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.

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Even if you don't use the ORM, stuff like create_engine 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.
2

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?

2 Comments

It's not a frontend; it's an API for one. I'm looking for a module.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.