public inbox for [email protected]  
help / color / mirror / Atom feed
From: Denis Laxalde <[email protected]>
To: [email protected]
Subject: Re: Executing on the connection?
Date: Tue, 8 Dec 2020 14:51:06 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+mi_8Y+fuzZcT+boRwcQKPd58B=bc324MA2=TAd6xuAvfuMmw@mail.gmail.com>
References: <CA+mi_8Yc92bX3qhTqXq4LkGyn5VmQj6uRAcVebpqt398Tm4EJA@mail.gmail.com>
	<CA+mi_8Y+fuzZcT+boRwcQKPd58B=bc324MA2=TAd6xuAvfuMmw@mail.gmail.com>

Daniele Varrazzo a écrit :
> On Wed, 2 Dec 2020 at 11:20, Daniele Varrazzo
> <[email protected]> wrote:
> 
>> I'm toying with the idea of adding a 'connection.execute(query,
>> [params])' methd, which would basically just create a cursor
>> internally, query on it, and return it. No parameter could be passed
>> to the cursor() call, so it could only create the most standard,
>> client-side cursor (or whatever the default for the connection is, if
>> there is some form of cursor_factory, which hasn't been implemented in
>> psycopg3 yet). For anything more fancy, cursor() should be called
>> explicitly.
> 
> This is what I've pushed earlier:
> 
> https://www.psycopg.org/psycopg3/docs/connection.html#psycopg3.Connection.execute
> 

It did not strike me earlier, but it looks a bit weird to have 
connection.execute() return a "cursor" to read results while this 
"cursor" can also be used to execute commands. So, perhaps, another 
object, with only the interface for result retrieval would be more 
appropriate?

Otherwise, that's a very nice addition, thanks!





view thread (13+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Executing on the connection?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox