public inbox for [email protected]  
help / color / mirror / Atom feed
From: Daniele Varrazzo <[email protected]>
To: Christophe Pettus <[email protected]>
Cc: Denis Laxalde <[email protected]>
Cc: [email protected]
Subject: Re: about client-side cursors
Date: Thu, 4 Feb 2021 16:24:22 +0100
Message-ID: <CA+mi_8YQrVtsL7M_=CyopyeyL3wFYTU73FQ7p6fzvZ=s56Qc9w@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CA+mi_8a1ery2xvb+AdxMtVXydOdGC7wRMnfXNAvk8v73HsLFyw@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On Thu, 4 Feb 2021 at 16:17, Christophe Pettus <[email protected]> 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





view thread (22+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: about client-side cursors
  In-Reply-To: <CA+mi_8YQrVtsL7M_=CyopyeyL3wFYTU73FQ7p6fzvZ=s56Qc9w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox