Re: about client-side cursors - Mailing list psycopg

From Denis Laxalde
Subject Re: about client-side cursors
Date
Msg-id 20210204150203.iuophq3yx7nzpfzo@dalibo.com
Whole thread Raw
In response to Re: about client-side cursors  (Christophe Pettus <xof@thebuild.com>)
Responses Re: about client-side cursors  (Christophe Pettus <xof@thebuild.com>)
List psycopg
Christophe Pettus a écrit :
> > On Feb 4, 2021, at 03:16, Denis Laxalde <denis.laxalde@dalibo.com> wrote:
> > But, unless I missed it, the PEP does not state how to implement query
> > execution and result fetch operations if the database does not need a
> > cursor.
> 
> First, any change like this would have to maintain their current API
> essentially forever, unless psycopg3 represents a completely
> incompatible break with the psycopg2 interface.  There is an enormous
> body of code out there that uses the current cursor() interface for
> client-side cursors.

Sure, that's a valid point. But maintaining this backwards compatibility
does not mean we can't hide the details and advertise a cleaner API for
newcomers or people willing to migrate.

> Second, it would be very unwise to make guarantees about when these
> operations interact with the database.  I think that any client
> application should expect that both cursor.execute() and
> cursor.fetchone()/.fetchall() are asynchronous operations, and code
> appropriately.

If "cursor" is a real database cursor, I agree.



psycopg by date:

Previous
From: Christophe Pettus
Date:
Subject: Re: about client-side cursors
Next
From: Christophe Pettus
Date:
Subject: Re: about client-side cursors