views:

46

answers:

1

With PostgreSQL, one of my tables has an 'interval' column, values of which I would like to extract as something I can manipulate (datetime.timedelta?); however I am using PyGreSQL which seems to be returning intervals as strings, which is less than helpful.

Where should I be looking to either parse the interval or make PyGreSQL return it as a <something useful>?

+2  A: 

Use Psycopg 2. It correctly converts between Postgres's interval data type and Python's timedelta.

Kevin
Thanks, I'll look into it
Ellery Newcomer