Re: Executing on the connection?

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: Executing on the connection?
Дата
Msg-id CA+mi_8YgOjGA3P9sBY4nVsE=_f6BbCi3OE-ZPz=LZoP5yEtedA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Executing on the connection?  (Denis Laxalde <denis.laxalde@dalibo.com>)
Список psycopg
On Tue, 8 Dec 2020 at 13:51, Denis Laxalde <denis.laxalde@dalibo.com> wrote:

> 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?

It thought about that, and it would be weird if people used a cursor
for further queries after consuming it, yes. But hey, who are we to
deny them to do that? :D I wouldn't go about creating and maintaining
new objects and interfaces only to limit the possibility.

My idea is that those who are interested in using `conn.execute()` are
exactly the people who don't care about having execute() on a cursor.
I think there's no harm in leaving it there :)

-- Daniele



В списке psycopg по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Executing on the connection?
Следующее
От: Hagen Finley
Дата:
Сообщение: BACK: Inserting a variable into cur.execute statement