Re: plpython timestamp without time zone, showing up as text instead of timestamp

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: jared <afonit(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpython timestamp without time zone, showing up as text instead of timestamp
Date: 2014-03-23 18:34:50
Message-ID: 532F294A.6040208@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/23/2014 09:47 AM, jared wrote:
>
>
>
> On Sun, Mar 23, 2014 at 12:11 PM, Adrian Klaver
> <adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
>
>
> Intended:
>
> http://www.postgresql.org/__docs/9.3/interactive/plpython-__data.html <http://www.postgresql.org/docs/9.3/interactive/plpython-data.html>
>
> FYI, it would be a good idea to include the Postgres version.
> plpython has been undergoing a lot of changes recently, so it would
> help to peg where you are at in that sequence.
>
>
> Ah, I see it now:
> "All other data types, including the PostgreSQL character string types,
> are converted to a Python str."
> Thanks (as an aside Postgres 9.3 and python 2.7)
>
> I find dateutil(https://labix.org/__python-dateutil
> <https://labix.org/python-dateutil>) a handy package to have in this
> situation. Use parse() from the parser module to do the heavy
> lifting of converting from a string into a date/datetime object.
>
>
> I will look into that - thanks again.

Should have added previously, if you use dateutil you can dispense with:

from datetime import datetime, timedelta

and use the relativedelta module from dateutil to do your offsets

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Álvaro Nunes Lemos Melo 2014-03-23 23:58:03 Upgrading from 9.2 to 9.3 causes performance degradation
Previous Message jared 2014-03-23 16:47:25 Re: plpython timestamp without time zone, showing up as text instead of timestamp