Re: improving async support in psycopg

Daniele Varrazzo <[email protected]> Fri, 26 Mar 2010 15:26:21 +0000
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Fri, Mar 26, 2010 at 2:58 PM, Jan Urbański <[email protected]> wrote:
> Daniele Varrazzo wrote:
>> On Fri, Mar 26, 2010 at 3:20 AM, Jan Urbański <[email protected]> wrote:
>
> Hi,
>
> I noticed that you didn't CC: the list - is that intentional? I will CC:
> the list on reply, I hope you don't mind.

No, I simply hit the wrong button (which I regularly do, but then I
usually notice it a second later and CC the list too...)


>> Another question: how do you think async connections and named cursors
>> mix? Basically in named cursors the fetch* methods are blocking too.
>> Does your patch already address them?
>
> Yes, it raises an exception when you try to create a named cursor from
> an async connection :o)
>
> I outlined a possible approach for named cursor in a different email,
> but basically I think it might not be worth it. The problem is that the
> cursor gets declared when you do execute() (and this would work
> asynchronously), but then when you do fetch() it actually issues another
> query (FETCH FROM) and this means that the fetch() method would have to
> be async... I think it could be solved by adding yet another method that
> would mediate between execute() and fetch(), which I proposed to call
> load().

Yes, the correct (awsome) behavior would be to perform an async fetch.

I read again the mail where you propose load(). I am thinking that
having the "wait hook" in place, it could get called by `fetch*()`
before returning the value, but I am talking a little bit too much
about this yet-vapor feature, so I'd rater write something before.

> You can always issue your DECLARE CURSOR and FETCH FROM calls yourself.
> For instance, to really use async connections you will have to turn off
> the psycopg2 transaction management and issue BEGIN and COMMIT yourself,
> because currently they both are blocking.

Oh, I haven't notice that. Can't they be handled using the same async machinery?

Regards,

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