Ellery Newcomer
Ellery Newcomer

Reputation: 1644

python sql interval

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>?

Upvotes: 0

Views: 2382

Answers (1)

Kevin
Kevin

Reputation: 3431

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

Upvotes: 3

Related Questions