Re: Executing on the connection? - Mailing list psycopg

From Christophe Pettus
Subject Re: Executing on the connection?
Date
Msg-id 0616EEA0-1551-40C7-BB2A-A0500FE0518C@thebuild.com
Whole thread Raw
In response to Executing on the connection?  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Responses Re: Executing on the connection?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List psycopg

> On Dec 2, 2020, at 03:20, Daniele Varrazzo <daniele.varrazzo@gmail.com> wrote:
> One little change I've made to psycopg3 cursors is to make it return
> "self" on execute() (it currently returns None, so it's totally
> unused).

Very nice!

> As a result people could use:
>
>    conn = psycopg3.connect(dsn)
>    record = conn.execute(query, params).fetchone()
>    # or
>    for record in conn.execute(query, params):
>        ... # do something

+1.  I think it would be a handy addition.

--
-- Christophe Pettus
   xof@thebuild.com




psycopg by date:

Previous
From: Daniele Varrazzo
Date:
Subject: Executing on the connection?
Next
From: Rory Campbell-Lange
Date:
Subject: Re: Executing on the connection?