Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkQDT-00070Y-LB for psycopg@arkaria.postgresql.org; Wed, 02 Dec 2020 11:22:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kkQDS-0000tL-Jw for psycopg@arkaria.postgresql.org; Wed, 02 Dec 2020 11:22:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkQDS-0000tE-8D for psycopg@lists.postgresql.org; Wed, 02 Dec 2020 11:22:34 +0000 Received: from smtp78.ord1c.emailsrvr.com ([108.166.43.78]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkQDQ-0001U0-4Z for psycopg@postgresql.org; Wed, 02 Dec 2020 11:22:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=g001.emailsrvr.com; s=20190322-9u7zjiwi; t=1606908150; bh=4Bp+eegyw59l97sfuKZ9pV23PVjrZQOk2+CTZMSS5hs=; h=Subject:From:Date:To:From; b=efU/U0sQRreraqKLRia2v+oEkg1eDY3nugtP5TWO/8hozNPYsrhGPPExeXrj2WSMB 3YCjqaw40/E+u2UryoF5+Hp26OTmmIPDehgJC9A9VKsLM6jVgtPvFrYmWDsduw1iAf A5Z1xgEMMWq8Yr1OBXtvtaUYZVMe+bVNIBz0wPWQ= X-Auth-ID: xof@thebuild.com Received: by smtp2.relay.ord1c.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id B10CAC0455; Wed, 2 Dec 2020 06:22:29 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.5\)) Subject: Re: Executing on the connection? From: Christophe Pettus In-Reply-To: Date: Wed, 2 Dec 2020 03:22:28 -0800 Cc: psycopg@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <0616EEA0-1551-40C7-BB2A-A0500FE0518C@thebuild.com> References: To: Daniele Varrazzo X-Mailer: Apple Mail (2.3445.9.5) X-Classification-ID: 89dcc398-47bc-4f06-ac1d-79767113232c-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Dec 2, 2020, at 03:20, Daniele Varrazzo = 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: >=20 > conn =3D psycopg3.connect(dsn) > record =3D 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