Convert to/from timezone aware datetimes when storing in a DBMS
Project description
Installation
pip install sqlalchemy-utcdatetime
Sample Usage
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy_utcdatetime import UTCDateTime
import datetime, pytz
Base = declarative_base()
class MyModel(Base):
__tablename__ = 'my_model'
id = sa.Column(sa.Integer(), primary_key=True)
my_datetime = sa.Column(UTCDateTime())
m = MyModel()
m.my_datetime = datetime.datetime.now(pytz.timezone('Australia/Sydney'))
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
Close
Hashes for SQLAlchemy-UTCDateTime-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 061c361fd5e2085bdd5ad8671c8262eaca26eda00507cdb4d15ae5e88aa39b62 |
|
MD5 | b45586c0dabb0149d259d20256376fb4 |
|
BLAKE2b-256 | f1d380d48df9b42d173871ea2e7ff6d0eac391bb7d5b5ed0879a97eec4d2669c |