| From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
|---|---|
| To: | Christophe Pettus <xof(at)thebuild(dot)com> |
| Cc: | Denis Laxalde <denis(dot)laxalde(at)dalibo(dot)com>, psycopg(at)postgresql(dot)org |
| Subject: | Re: about client-side cursors |
| Date: | 2021-02-04 15:24:22 |
| Message-ID: | CA+mi_8YQrVtsL7M_=CyopyeyL3wFYTU73FQ7p6fzvZ=s56Qc9w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | psycopg |
On Thu, 4 Feb 2021 at 16:17, Christophe Pettus <xof(at)thebuild(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Denis Laxalde | 2021-02-04 16:38:52 | Re: about client-side cursors |
| Previous Message | Christophe Pettus | 2021-02-04 15:17:37 | Re: about client-side cursors |