Re: Executing on the connection?

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: Executing on the connection?
Date: 2020-12-02 11:22:28
Message-ID: 0616EEA0-1551-40C7-BB2A-A0500FE0518C@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

> On Dec 2, 2020, at 03:20, Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)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(at)thebuild(dot)com

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Rory Campbell-Lange 2020-12-02 12:48:07 Re: Executing on the connection?
Previous Message Daniele Varrazzo 2020-12-02 11:20:16 Executing on the connection?