[Twisted-Python] Case for an Async MySQL Driver?
L. Daniel Burr
ldanielburr at mac.com
Thu Oct 28 17:12:23 EDT 2004
Seun Osewa wrote:
>Here are some ideas for an async MySQL 'driver' for Twisted:
[snip description of API]
>This format allows the user to send an unlimited number of queries to
>be run together, thus limiting the number of callbacks necessary for a
>program requiring many small interactions with the database. "begin"
>and "end" will count as an example. This minimalistic API also allows
>more advanced (twisted.enterprise style) interfaces to be built on top
I think that this is a good idea, but I think it would be far better if you described your API in terms of the twisted.enterprise.adbapi API which exists today.
from twisted.enterprise import adbapi
dbpool = adbapi.NonBlockingConnectionPool(
queries = ('SELECT 1 FROM DUAL', 'UPDATE Foo WHERE bar = baz')
for query in queries:
d = dbpool.runQuery(query)
The effort needed to make this proposed asynchronous db protocol work with adbapi would be pretty minor, I think.
Tell you what: If somebody implements this MySQL async protocol, I'll create a patch to make adbapi work with it. Sound good?
More information about the Twisted-Python