[Twisted-Python] laxdb - an async dbapi wrapper

Itamar Shtull-Trauring itamar at itamarst.org
Wed Aug 31 10:25:08 EDT 2005

On Wed, 2005-08-31 at 13:31 +0100, Matt Goodall wrote:

> A while back, I started messing around with making a standard, blocking
> db-api module appear non-blocking but with a deferred API. I called it
> laxdb and it's in my sandbox.
>   svn://svn.twistedmatrix.com/svn/Twisted/sandbox/mg/laxdb.py
>   http://svn.twistedmatrix.com/cvs/sandbox/mg/laxdb.py?view=markup

I get the impression from your example:

    def connected(conn):
        curs = conn.cursor()
        d = curs.execute("select * from test")
        d.addCallback(lambda ignore: curs.fetchall())
        d.addCallback(lambda rows: pprint(rows))
        # ...

that you keep dispatching to a thread, then passing it back to Twisted
thread, repeatedly, unlike runInteraction which only does this once. I
would guess that this will slow down complex database interactions

More information about the Twisted-Python mailing list