Re: about client-side cursors - Mailing list psycopg

From Daniele Varrazzo
Subject Re: about client-side cursors
Date
Msg-id CA+mi_8YQrVtsL7M_=CyopyeyL3wFYTU73FQ7p6fzvZ=s56Qc9w@mail.gmail.com
Whole thread Raw
In response to Re: about client-side cursors  (Christophe Pettus <xof@thebuild.com>)
List psycopg
On Thu, 4 Feb 2021 at 16:17, Christophe Pettus <xof@thebuild.com> wrote:

> Having a single convenience method on the connection object that does the equivalent of a .execute() and a
.fetchall()might be useful, though.
 

You can already do it (in psycopg3):

    for record in conn.execute("query"):
        # do stuff

or

    records = conn.execute("query").fetchall()

or

    record = conn.execute("query").fetchone()

The latter examples are two methods, not one, but I think they compose
nicely enough, no? They are pretty orthogonal.


-- Daniele



psycopg by date:

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