Re: psycopg3 and cur.description behavior

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Paolo De Stefani <paolo(at)paolodestefani(dot)it>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: psycopg3 and cur.description behavior
Date: 2021-10-03 18:55:47
Message-ID: CA+mi_8bDaC10m4Bv5-huM_8Gajs-_4eX5VwMPy-L6XdatxRuKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Sun, 3 Oct 2021 at 18:35, Paolo De Stefani <paolo(at)paolodestefani(dot)it> wrote:

> By the way i didn't see any cur.mogrify() in psycopg 3 and no logging
> cursor as well something i used frequently
> Are they no more available ? Any plan to include them in next versions ?

There is no mogrify, no, because queries are not composed by the
client anymore, but they are sent to the server separately from the
arguments. Mogrify would be misleading because the same query might
behave differently if parameters are merged by the server or by the
client.

The logging cursor, I don't think should exist as an option: the
logging system itself has the option of being enabled or disabled. So,
if any, I think psycopg should log every query, let's say at info
level, which would normally be discarded, unless the user enables it
with a getLogger("psycopg").setLevel(logging.INFO). However that's not
in, because I have a fear (but not a measure) that it would add some
overhead. Which is totally premature optimisation, I am aware.

Maybe someone would like to help and get some measurement of how much
overhead does logging add? Comparing no logging/disabled
logging/enabled logging?

Cheers

-- Daniele

In response to

Browse psycopg by date

  From Date Subject
Next Message Dan Davis 2021-10-04 23:01:04 How to build statically on Windows
Previous Message Paolo De Stefani 2021-10-03 16:35:41 Re: psycopg3 and cur.description behavior