Newbie - does Python have DB Independent interface?

Gerhard Häring gh_pythonlist at gmx.de
Wed May 15 10:10:56 EDT 2002


* Hardy Merrill <hmerrill at redhat.com> [2002-05-15 09:39 -0400]:
> I come from the Perl world, and am starting to learn Python.
> Perl has the DBI module which is a Database Independent interface -
> you write programs to the DBI api, and then if you choose to
> change your database, your code needs to change very little, or
> maybe not at all.
> 
> Does Python have anything similar,

Yes, the Python DB-API v2. The API, and a list of available database
interfaces, can be found here:

http://www.python.org/topics/database/

> or must you choose your database right up front, and write all your
> code specific to that one database?

No, in an ideal world, you'd only need to import a different module and
call a different form of connection method when switching databases, but
alas, the parameter quoting is not standardized by the API (it allows
one of several possible parameter quoting forms), and the API is lacking
a standardized way to nicely access columns in query results.

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 20.2 °C      Wind: 5.2 m/s





More information about the Python-list mailing list