[clug] Python & databases

Daniel Pittman daniel at rimspace.net
Mon Feb 22 06:45:32 MST 2010

Paul Wayper <paulway at mabula.net> writes:
> On 22/02/10 17:30, Hal Ashburner 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.
> (This is the point where most of ther Perl programs pat their 'dbi' module
>  and smile smugly.)

If they do that we should point at them and laugh; if you read the dbapi2
documentation you will find it at about the same level: a generic interface to
execute, fetch, cursors, and so forth.

Now, if you pointed at SQL::Abstract[1], SQL::Filter, SQL::Translator[2], or
maybe an ORM half-way-house like SQL::DB, you might have a point.  (If I read
the OP correctly. ;)

Heck, depending on the needs you might get away with SQL::QueryBuilder, or one
of the other "select" wrappers.  But that might be seen as boastful. ;)


Of course, this is CPAN, so 90 percent of those modules suck.  On the other
hand, the same is probably true of any other language too...

[1]  I have actually used this and can (at least vaguely) recommend it.
     Um, you probably want DBIx::SQL::Abstract, though, to nicefy it. ;)

[2]  ...or maybe that is a bit on the strange side, mostly being an SQL-to-SQL
     transformation engine.

✣ Daniel Pittman            ✉ daniel at rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons

More information about the linux mailing list