SQLAlchemy type to store aware datetime values
Project description
SQLAlchemy-Utc
This package provides a drop-in replacement of SQLAlchemy’s built-in DateTime type with timezone=True option enabled. Although SQLAlchemy’s built-in DateTime type provides timezone=True option, since some vendors like SQLite and MySQL don’t provide timestamptz data type, the option doesn’t make any effect on these vendors.
UtcDateTime type is equivalent to the built-in DateTime with timezone=True option enabled on vendors that support timestamptz e.g. PostgreSQL, but on SQLite or MySQL, it shifts all datetime.datetime values to UTC offset before store it, and returns always aware datetime.datetime through result sets.
Long story short, UtcDateTime does:
take only aware datetime.datetime,
return only aware datetime.datetime,
never take or return naive datetime.datetime,
ensure timestamps in database always to be encoded in UTC, and
work as you’d expect.
Written by Hong Minhee at Spoqa, and distributed under MIT license.
Changelog
0.9.0
First version. Released on June 21, 2016.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for SQLAlchemy_Utc-0.9.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a04ce6627ab914653553f8409f4b1cf1be5c8c25ab0d74bb7a4968cee655ae35 |
|
MD5 | 4acdd6271da6704f190af226bea32c5b |
|
BLAKE2b-256 | e6dc5783b0e51bf38b3af38379eb256e13d38d4944c5304dfd449b67e84dfbed |