Re: Reporting UnicodeEncodeError info on arbitrary data sent to PG with psycopg3

2024-02-15 Thread Karl O. Pinc
On Wed, 14 Feb 2024 19:28:57 +0100 Daniele Varrazzo wrote: > On Wed, 14 Feb 2024 at 16:42, Karl O. Pinc wrote: > > > I did not use conn.info.encoding because the docs say that it > > contains the _client_ encoding, not the server-side encoding > > used

Re: Reporting UnicodeEncodeError info on arbitrary data sent to PG with psycopg3

2024-02-14 Thread Karl O. Pinc
Hi Daniele, On Wed, 14 Feb 2024 15:30:33 +0100 Daniele Varrazzo wrote: > Note however that if you just want to know the Python codec you can > find it in `conn.info.encoding` > (https://www.psycopg.org/psycopg3/docs/api/objects.html#psycopg.ConnectionInfo.encoding): > > >>> conn.info.encodi

Reporting UnicodeEncodeError info on arbitrary data sent to PG with psycopg3

2024-02-13 Thread Karl O. Pinc
Hi, I'm writing a program which takes a text file from the user, constructs an INPUT statement (the table and column names are not known in advance), and uses the constructed statement to insert rows of the text file into PG. psycopg3 v3.1.18 (installed in a venv) PG v15.5 Python 3.11.2 Debian 12