[Twisted-Python] laxdb - an async dbapi wrapper

Matt Goodall matt at pollenation.net
Wed Aug 31 11:26:24 EDT 2005

James Y Knight wrote:

> On Aug 31, 2005, at 8:31 AM, Matt Goodall wrote:
>> In response to the announcement of the Twisted Asynchronous  Database
>> Api
>> (tada), <http://www.darkarts.co.za/projects/tada/, I thought I should
>> mention something I 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.
> I think it'd be nice to get something like one of these into twisted 
> to supplement/replace adbapi, but it'd probably be best to make sure 
> that the wrapper for blocking databases and pgasync can use the same 
> interface first.

Well ... I did do that at first but pgasync isn't quite dbapi compatible
and it also has a couple of oddities that I'm not sure about.

My memory is a bit fuzzy about all this now but the main thing is that
pgasync queues queries.

There's basically a chain of deferreds internal to a pgasync connection.
In some ways, it makes pgasync easier to use, because it looks like
stuff is not deferred, but I actually found it irritating after a while.
Personally, I think if something is async it might as well look async.

There are also a number of bugs (in my opinion) which mean pgasync is
not dbapi  compatible but those can probably be fixed over time.

Anyway, I agree that this would be good but there are a couple of API
issues that need solving first before it's possible.

Note: I don't think laxdb is an adbapi replacement. adbapi has its
advantages but at the cost of losing a bit of control over how and when
database operations happen. They're probably just different.

- Matt

    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.

More information about the Twisted-Python mailing list