Can SQLAlchemy DateTime Objects Only Be Naive?
Posted
by Sean M
on Stack Overflow
See other posts from Stack Overflow
or by Sean M
Published on 2010-03-27T05:01:00Z
Indexed on
2010/03/27
5:03 UTC
Read the original article
Hit count: 303
I am working with SQLAlchemy, and I'm not yet sure which database I'll use under it, so I want to remain as DB-agnostic as possible. How can I store a timezone-aware datetime object in the DB without tying myself to a specific database? Right now, I'm making sure that times are UTC before I store them in the DB, and converting to localized at display-time, but that feels inelegant and brittle. Is there a DB-agnostic way to get a timezone-aware datetime out of SQLAlchemy instead of getting naive datatime objects out of the DB?
© Stack Overflow or respective owner