[clug] Python & databases

Brendan Jurd direvus at gmail.com
Sun Feb 21 23:44:19 MST 2010


On 22 February 2010 17:30, Hal Ashburner <hal.ashburner at gmail.com> wrote:
> I'm playing with some python code that needs to connect to a database.
> Ideally I'd like to be able to use differing database back ends with the
> same application. I don't want to use sql alchemy and all it's ORM stuff.
> Has anyone done this kind of thing in python? The dbapi2 stuff seems fairly
> backend specific.

The idea of dbapi is to provide an API that is consistent regardless
of which driver you're using, so I'm not sure what you're driving at
when you say "seems fairly backend specific".  In what sense?

dbapi (deliberately) only specifies API conventions for a very basic
subset of operations, but unless you're looking to do something fancy,
that shouldn't be a hindrance [1].

Cheers,
BJ

[1] If you're doing anything non-trivial with databases you will need
to write different SQL for the different backends anyway because each
DBMS will have a different feature set, different interpretation of
the SQL standard, different ways of optimising queries ...


More information about the linux mailing list