From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
---|---|
To: | Paolo De Stefani <paolo(at)paolodestefani(dot)it> |
Cc: | Psycopg <psycopg(at)postgresql(dot)org> |
Subject: | Re: From spycopg2 to psycopg3 data adaptation |
Date: | 2021-10-05 12:05:12 |
Message-ID: | CA+mi_8YxxD_CYqLySiSwLJZvwSmgaQHHzyQFdtjfevhYqV6JoQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On Tue, 5 Oct 2021 at 13:30, Paolo De Stefani <paolo(at)paolodestefani(dot)it> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Jason Erickson | 2021-10-05 18:10:51 | Re: How to build statically on Windows |
Previous Message | Paolo De Stefani | 2021-10-05 11:29:52 | From spycopg2 to psycopg3 data adaptation |