[DB-SIG] Time to consider a PEP-249 replacement/revision?

Andy Dustman farcepest at gmail.com
Tue Feb 23 03:50:05 CET 2010


Lately it seems there has been a lot of grousing from the asynchronous
folks (Twisted et al) about not being able to use DB-API databases
(specifically MySQL) in an async environment. I recently wrote this
post about it:

http://mysql-python.blogspot.com/2010/02/asynchronous-programming-and-mysqldb.html

In writing it, I realized that the DB-API by it's very nature is a
synchronous interface, and if we are going to support asynchronous
access, we should have some kind of API for it. This can either be a
DB-API extension or a new API.

A very brief survey of relational databases:

MySQL: The C client library has no documented asynchronous support.
However the wire protocol is relatively simple, and there are
implementations in Python and other languages, and in principle async
support could be done. The main issue is that you still could only
have one active result set per connection, but that's a concurrency
issue. There are async perl and php drivers.

PostgreSQL: I think there is direct C client library support. Looking
at the docs for psycopg2, there is some support for async, but it
appears to be disabled:

https://dndg.it/cgi-bin/gitweb.cgi?p=public/psycopg2.git;a=blob_plain;f=doc/async.txt;hb=HEAD

SQLite: Seems to have some async support, but it uses threads, and
it's in the database itself (writing to desk), not the client. Well,
since it's basically an embedded database anyway, the distinction is
basically meaningless.

ODBC stuff: There seems to be some async support floating around out
there, but looking through the mx.ODBC docs briefly, there doesn't
seem to be support for it.

Any strong feelings about what this support should look like?

-- 
Patriotism means to stand by the country. It does
not mean to stand by the president. -- T. Roosevelt

MANDATED GOVERNMENT HEALTH WARNING:
Government mandates may be hazardous to your health.

This message has been scanned for memes and
dangerous content by MindScanner, and is
believed to be unclean.


More information about the DB-SIG mailing list