Re: improving async support in psycopg

Daniele Varrazzo <[email protected]> Sun, 28 Mar 2010 02:35:22 +0100
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Sat, Mar 27, 2010 at 2:40 AM, Jan UrbaƄski <[email protected]> wrote:

> 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?

As things are now, execute and callproc being the only methods using
async features, this is the case. Probably it will be too extending
support to other currently blocking methods (begin/commit/rollback
etc).

Yes, it is probably the case to think about Python subclasses to add a
wait wrapper around async methods. the psycopg.extras module could
provide such wrappers exposing a method, equivalent to the callback in
my test, to be customized by async libraries to fit their framework.

Regards,

-- Daniele
_______________________________________________
Psycopg mailing list
[email protected]
http://lists.initd.org/mailman/listinfo/psycopg