[Twisted-Python] laxdb - an async dbapi wrapper

Christopher Armstrong radeex at gmail.com
Wed Aug 31 18:48:06 EDT 2005


On 9/1/05, Itamar Shtull-Trauring <itamar at itamarst.org> wrote:
> 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
> somewhat.

Yeah, but the usual way to use adbapi is the same, isn't it? i.e.,
runQuery calls. Sounds like you're comparing apples to oranges (on the
other hand, I guess it would be nice if lax-db had a runInteraction).

-- 
  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    -- http://radix.twistedmatrix.com
            |  Release Manager, Twisted Project
  \\\V///   |    -- http://twistedmatrix.com
   |o O|    |  
w----v----w-+




More information about the Twisted-Python mailing list