public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ams Fwd <[email protected]>
To: Daniele Varrazzo <[email protected]>
Cc: [email protected]
Subject: Re: 2-to-3 Question about adapter using AsIs
Date: Mon, 20 Nov 2023 17:24:32 -0800
Message-ID: <CAP80KYroXEQYZ7x+xVPT1RTGV8H7ESra4KRdY7Lz4wM6vRLMCw@mail.gmail.com> (raw)
In-Reply-To: <CA+mi_8ZNjBJCX3BZwThrmnBJqoTRoq6ZE=dkyefV+vw4uk4UJg@mail.gmail.com>
References: <CAP80KYqSayFXWFAG59==tX+cH+_vi1eiYuW8KQdDYsD1JE-YZg@mail.gmail.com>
	<CA+mi_8ZNjBJCX3BZwThrmnBJqoTRoq6ZE=dkyefV+vw4uk4UJg@mail.gmail.com>

Hi.

On Mon, Nov 20, 2023 at 2:46 PM Daniele Varrazzo
<[email protected]> wrote:

So it turns out that the Django default, at least for 4.2 is ClientCursors :)

https://docs.djangoproject.com/en/4.2/ref/databases/#server-side-parameters-binding

Which means I can get the `quote` based solution work ootb.

Thanks a ton for the clarification.
AM

> but you can only use `PostgresDefaultValueType` with a ClientCursor
> (or in a `sql.Literal()`); you can visualize the query that a client
> cursor would execute using the classic `mogrify()`:
>
>     >>> cur = psycopg.ClientCursor(conn)
>     >>> cur.mogrify("INSERT INTO tbl (f1, f2) VALUES (%s, %s)",
> [PostgresDefaultValueType(), "hell'o"])
>     "INSERT INTO tbl (f1, f2) VALUES (DEFAULT, 'hell''o')"
>






view thread (3+ messages)

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: 2-to-3 Question about adapter using AsIs
  In-Reply-To: <CAP80KYroXEQYZ7x+xVPT1RTGV8H7ESra4KRdY7Lz4wM6vRLMCw@mail.gmail.com>

* 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