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