From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Denis Laxalde <denis(dot)laxalde(at)dalibo(dot)com>, psycopg(at)lists(dot)postgresql(dot)org |
Subject: | Re: Executing on the connection? |
Date: | 2020-12-08 14:44:56 |
Message-ID: | 7e10dc93-dd36-6494-9d7a-6cad3cecacdb@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On 12/8/20 5:51 AM, Denis Laxalde wrote:
> Daniele Varrazzo a écrit :
>> On Wed, 2 Dec 2020 at 11:20, Daniele Varrazzo
>> <daniele(dot)varrazzo(at)gmail(dot)com> 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?
Why? It is no different from now where you can reuse a cursor.
>
> Otherwise, that's a very nice addition, thanks!
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2020-12-08 14:56:14 | Re: Executing on the connection? |
Previous Message | Denis Laxalde | 2020-12-08 13:51:06 | Re: Executing on the connection? |