Re: improving async support in psycopg

Jan UrbaƄski <[email protected]> Sat, 27 Mar 2010 03:40:57 +0100
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 27/03/10 03:21, Daniele Varrazzo wrote:
> On Fri, Mar 26, 2010 at 7:29 PM, Daniele Varrazzo
> <[email protected]>  wrote:
>
>> I've written a first version of the wait_callback idea: code is
>> available from the 'async' branch of
>> http://piro.develer.com/psycopg2.git (gitweb:
>> https://www.develer.com/gitweb/pub?p=users/piro/psycopg2.git;a=summary).
>
>> [...]

> Here is a testing script I wrote to check that the async feature works
> as expected (using gevent).

Awesome, I'll try to take a look over the weekend. Looks like you beat 
me to writing an example using $your_favourite_async_library ;)

Skimming over the patches I have a question: is it really necessary to 
add the callback feature into the C library? AFAICS the callback is 
executed on asynchronous cursors everytime there is a execute() attempt. 
Couldn't you just write a Python psycopg2.extensions.cursor subclass 
that overrides execute() by calling that callback?

Cheers,
Jan