Re: [psycopg] Using infinite values with DateTimeTZRange
| От | Daniele Varrazzo |
|---|---|
| Тема | Re: [psycopg] Using infinite values with DateTimeTZRange |
| Дата | |
| Msg-id | CA+mi_8bkMQ_LRL-Q3oyX5qtZbu5LHDPi+50kbtcCnfi34-UM4g@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: [psycopg] Using infinite values with DateTimeTZRange (Daniele Varrazzo <daniele.varrazzo@gmail.com>) |
| Список | psycopg |
On Mon, Aug 21, 2017 at 1:14 PM, Daniele Varrazzo
<daniele.varrazzo@gmail.com> wrote:
[...]
> else:
> return psycopg2.extensions.DateFromPy(self.wrapped).getquoted()
>
> psycopg2.extensions.register_adapter(datetime, InfDateTimeTZAdapter)
>
> Once the dt adapter is fixed, the range adapter will use it automatically:
>
> >>> print psycopg2.extensions.adapt(validity).getquoted()
> tstzrange('2017-08-21T12:59:11.486205+00:00'::date,
> 'infinity'::datetimetz, '[)')
Sorry, this is obviously a bug in handling the not infinity dates :)
The else should be:
return psycopg2.extensions.TimestampFromPy(self.wrapped).getquoted()
with which the range adapter will return an adapted value like:
tstzrange('2017-08-21T13:23:49.222454+00:00'::timestamptz,
'infinity'::datetimetz, '[)')
-- Daniele
В списке psycopg по дате отправления: