[Twisted-Python] About adodb

Simon simon at hedberg.net
Fri Oct 1 05:26:33 MDT 2004


Dave, thanks for your reply.

>I'm not too familiar with ADOdb, what are the benefits?
Quoting the author:
"You might ask why Python needs a database abstraction library when
Python provides the official DB API. Unfortunately the DB API does not
encapsulate differences in the database implementations. For example, to
select a limited number of rows, say 10 rows, you would have to use very
different SQL for different databases. [...]
These differences are handled by ADOdb (using SelectLimit), but not by
the Python DB API. Other important database differences transparently
handled by ADOdb include date-formating, associative arrays (records as
dictionaries) and LOB-handling."

>By rewrite, do you mean that the new version only uses
>ADOdb, or have you added ADOdb as a supported back-end?
ADOdb adds a level of abstraction on top of db-api. I wrote a version of
ConnectionPool that uses adodb connections instead of the regular dbapi
connections and cursors. If this is something python developers find
useful, i don't know. I guess it isn't as necessary as in php (which i'm
switching from) where no common db-api exists, but I still think it's
quite a nice thing.

>sqlreflector and row could definitely use a reworking.
>I don't think they are used much. I think people mainly
>use adbapi and write their own object mapping system.
>What sort of things did you have in mind?
Well mainly validating the data assigned to a rowobject so one can be
sure it makes it into the db (checking data length, proper dates etc).
But if row and sqlreflector isn't used I'll probably build something new
instead of going through that code. I'm thinking of using the db_row
module (http://opensource.theopalgroup.com) which seems to offer
efficient row data access.

/Simon
(STemplar)





More information about the Twisted-Python mailing list