DBAPI
Andy Todd
andy47 at halfcooked.com
Mon Apr 22 21:32:30 EDT 2002
John Goerzen <jgoerzen at complete.org> wrote in
news:87adrvambl.fsf at complete.org:
> Hi,
>
> I have some DB-API questions.
>
> I have used things like JDBC for Java and DBI for Perl. To me, DBAPI
> for Python looks rather week. For instance, if the code is to be
> truly portable across databases, I'd have to check the paramstyle for
> the driver and write each query 5 times!
>
> Is there any "meta-DBAPI" module that I can use that would present me
> with a standardized interface, and then (for instance) convert my
> queries to whatever format the backend wants?
>
> -- John
>
As far as I am aware there is no meta-DBAPI. In my experience when people
talk about standard database interfaces that enable them to write
portable code they haven't actually tried to write any. SQL isn't
standard so it is impossible to write database independent code for all
but the most trivial of applications.
I agree that the DB-API is a little flexible and does result in a number
of different styles, but it tries to guide rather than direct. Given the
diversity of databases that are supported by Python modules it is hardly
surprising that they all don't operate in exactly the same way.
On the other hand it is very hard to write Python db modules that will
work in exactly the same way on several databases anyway. The example you
give of parameter style is a case in point, most Python db modules stick
close to the implementation in the supplied database libraries rather
than try and wrestle them into some abritrary standard.
The value of any meta-DBAPI is in direct proportion to the amount of
effort it would take to change all of the existing db modules. Its not
impossible, but its a lot of hard work and no one has seen the need to do
this yet.
For more detailed discussion may I suggest moving to the DB-SIG mailing
list, for details see - http://mail.python.org/mailman/listinfo/db-sig
Regards,
Andy
--
Contents free posts a speciality
More information about the Python-list
mailing list