public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniele Varrazzo <[email protected]>
To: Paolo De Stefani <[email protected]>
Cc: Psycopg <[email protected]>
Subject: Re: From spycopg2 to psycopg3 data adaptation
Date: Tue, 5 Oct 2021 14:05:12 +0200
Message-ID: <CA+mi_8YxxD_CYqLySiSwLJZvwSmgaQHHzyQFdtjfevhYqV6JoQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
On Tue, 5 Oct 2021 at 13:30, Paolo De Stefani <[email protected]> wrote:
> class TimestamptzQDateTimeLoader(Loader):
> def load(self, value):
> if value is None:
> return None
A `None` will never make it here: you can drop this check in psycopg 3.
> BUT it's not working because the "value" is binary not string:
>
> <memory at 0x000000000939BA00>
>
> So how i can get the same result of psycopg2 in psycopg3 ?
You can use bytes(value) to get the value as bytes string, and if you
need a str you can use bytes(value).decode()
-- Daniele
view thread (2+ 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: From spycopg2 to psycopg3 data adaptation
In-Reply-To: <CA+mi_8YxxD_CYqLySiSwLJZvwSmgaQHHzyQFdtjfevhYqV6JoQ@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