Python Database Interfaces - Any Standard?

Thomas A. Bryan tbryan at python.net
Fri Dec 29 00:08:02 EST 2000


Martin von Loewis wrote:
> 
> "Thomas A. Bryan" <tbryan at python.net> writes:
> >
> > To change to PostgreSQL, you'd have to change the import and the connection.
> 
> If you anticipate change to another database, you write
> 
> import DCOracle as DB
> dbh = DB.Connect( connect_string )
> query = dbh.cursor()
> query.execute( query_string )
> 
> For PostgreSQL, you only need to write
> 
> import pg as DB

Thanks, but note that the connect_string probably still needs to change 
even if one tries to keep the database details (machine, instance, 
port, username, password) the same because the API doesn't specify the 
connection string, and I'm not sure how many modules follow its 
recommendation.  I hope to find out next year when I start playing 
with PostgreSQL.  :)

> Now, it is common that Python provides a wrapper module, like the os
> module or the anydbm module. However, there was no demand for such a
> wrapper in Python, yet.

It seems like there was some discussion of a generic wrapper on the db-sig 
this year, but I don't know what became of it.  

because-I-wasn't-paying-attention-at-the-time-ly yours
---Tom



More information about the Python-list mailing list