[Twisted-Python] recommended twisted database coding

Thomas Vander Stichele thomas at apestaart.org
Thu Jun 8 06:05:22 EDT 2006

Hi everyone,

As of late I've been thinking of rewriting an old PHP application that I
used to help out on in Python.  It would give me a chance to see if
Python and everything I"ve learned while learning Python would help me
overcome my innate disgust of doing database/web programming :)

The application in question is relatively simple - it's your average
"manage-all-my-music" application,  with artists, audio files, albums,
ratings, ... In the PHP version, I had already moved from doing raw SQL
queries everywhere to instantiating objects from the database, so the
idea of having an object model that abstracts away persistence to a
database is appealing.

Being a Twisted groupie I would prefer to use something that works well
with Twisted.  After looking at all the options available to me, I'm
getting a little confused, and would like some feedback to clear up the

- Twisted is, of course, async, so twisted.enterprise.adbapi wraps 2.0
DB API's using threads, which makes sense.  Are people using adbapi much
in production though ? From scanning the mailing list it seems like
people prefer layering stuff on top of adbapi to implement object

- Axiom seems like a nice Object layer with a database backend.
However, the part I don't understand is that suddenly the description
claims that Axiom is doing blocking SQLite calls, and that this isn't
really a problem.  Since Axiom is a Divmod project, I tend to trust
their opinion when it comes to Twisted.  But why is it suddenly OK to
have blocking code being used ? Does this only apply to SQLite, or would
it apply to any database being used ?

- SQLObject seems to come very close to what I would want to use to
abstract away the database backend, and just pretend that I only deal
with persistently stored python objects.  Has anyone managed to use
SQLObject in a twisted project ? If not, what's the closest I can get
that gives me the advantage of having a python object backend ?

- how do persistent object systems typically deal with transactions ?
Suppose you want to do three operations on three different objects as a
transaction, is that possible at all ?

- Are there any active projects that use a database backend, twisted,
persistent objects, and are freely available, that I can sneak a peek at
for my further education ?

Thanks in advance,

More information about the Twisted-Python mailing list