Re: psycopg3 and adaptation choices

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Christophe Pettus <xof(at)thebuild(dot)com>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: psycopg3 and adaptation choices
Date: 2020-11-10 03:30:47
Message-ID: CA+mi_8adFSjjE6hHrccKzt7YWKmB4PybtRLOp2k_ms9YD0v6SA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Tue, 10 Nov 2020 at 03:20, Christophe Pettus <xof(at)thebuild(dot)com> wrote:
>
> I don't want to derail this, but a question: Can a connection be set to use the simple-query protocol instead of the extended-query protocol in 3?

It won't be set explicitly to use simple/extended protocol, but if a
query is passed with no parameter (because it just has no variable
part, or because it's being composed client-side using functionalities
similar to psycopg2.sql) then the simple-query protocol is used [1].
This is mostly useful to pass several queries at once, because the
extended query protocol doesn't allow more than one query at time [2].

[1] https://github.com/psycopg/psycopg3/blob/bc02ae1c9c42892966ff079250c24ff5eae28b48/psycopg3/psycopg3/cursor.py#L243-L254
[2] https://www.postgresql.org/docs/current/libpq-exec.html#LIBPQ-PQEXECPARAMS

-- Daniele

In response to

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2020-11-10 03:43:29 Re: psycopg3 and adaptation choices
Previous Message Christophe Pettus 2020-11-10 03:22:19 Re: psycopg3 and adaptation choices