0

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

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

Not really psycopg2 returns a timedelta of -1 day, 23 hour when you have a value of -1 hour interval in your postgresql table

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.