Christoph Zwerschke wrote:
> Am 29.08.2016 um 04:40 schrieb raf:
> >What does work (lucky guess) is using str() as the typecast
> >function:
> >
> > pgdb.set_typecast('timestamptz', str) # Python2 at least
>
> Right, that's how you can access the raw data.
>
> Or alternatively,
>
> pgdb.set_typecast('timestamptz', lambda v: v)
>
> This works the same way in Python 3.
>
> See also:
>
> http://www.pygresql.org/contents/pgdb/module.html#get-set-reset-typecast-control-the-global-typecast-functions
>
> -- Chris
> _______________________________________________
> PyGreSQL mailing list
> [email protected]
> https://mail.vex.net/mailman/listinfo.cgi/pygresql
Hi,
Unfortunately, the changlog file gives incorrect instructions:
http://www.pygresql.org/contents/changelog.html
Dates, times, timestamps and time intervals are now returned as the
corresponding
Python objects from the datetime module of the standard library. In earlier
versions
of PyGreSQL they had been returned as strings. You can restore the old
behavior by
deactivating the respective typecast functions, e.g. set_typecast('date’,
None).
That "None" at the end should be changed to say "lambda v: v".
None doesn't restore the old behaviour, it deletes any non-default
typecast function that you might have put in place and reverts to
the new default nehaviour, not the old behaviour.
cheers,
raf
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql