Re: about client-side cursors

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: about client-side cursors
Дата
Msg-id CA+mi_8YQrVtsL7M_=CyopyeyL3wFYTU73FQ7p6fzvZ=s56Qc9w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: about client-side cursors  (Christophe Pettus <xof@thebuild.com>)
Список psycopg
On Thu, 4 Feb 2021 at 16:17, Christophe Pettus <xof@thebuild.com> wrote:

> Having a single convenience method on the connection object that does the equivalent of a .execute() and a
.fetchall()might be useful, though.
 

You can already do it (in psycopg3):

    for record in conn.execute("query"):
        # do stuff

or

    records = conn.execute("query").fetchall()

or

    record = conn.execute("query").fetchone()

The latter examples are two methods, not one, but I think they compose
nicely enough, no? They are pretty orthogonal.


-- Daniele



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

Предыдущее
От: Christophe Pettus
Дата:
Сообщение: Re: about client-side cursors
Следующее
От: Denis Laxalde
Дата:
Сообщение: Re: about client-side cursors