[Twisted-Python] XML-RPC Service with Database Access

Jean-Paul Calderone exarkun at divmod.com
Sat Sep 15 09:12:33 EDT 2007

On Sat, 15 Sep 2007 14:41:34 +0200, Stefan Arentz <stefan.arentz at gmail.com> wrote:
>I'm interested in using Twisted for a simple XML-RPC service that
>needs to talk to either PostgreSQL or MySQL. (I would prefer PG).
>I've got the XML-RPC part under control, that is fairly simple with
>Twisted Web. But what would I use for the database part? What is
>generally the easy way to do database access with Twisted?
>Are there ORM solutions that are compatible with Twisted? It would be
>nice if I could use something like SQLObject instead of raw queries.
>I'm not looking for a complete solution here. Just trying to
>understand what is usually done in Twisted land.

The only solution bundled with Twisted is twisted.enterprise.adbapi (well,
you might see some other stuff in twisted.enterprise, but I wouldn't suggest
using any of it).  adbapi is a very simple asynchronous interpretation of

This isn't anything like the ORM solution you were hoping for, though.
So far as I understand it, the typical API presented by an ORM is quite
unfriendly toward integration with a Twisted-style application.  Someone
else may know of some work which has been done to address this.

For what it's worth, I do use an ORM with Twisted applications (Axiom) -
but I use it only with SQLite: it presents a synchronous API, blocking for
as long as necessary to satisfy a query, which is typically not long enough
to be problematic for my applications.


More information about the Twisted-Python mailing list