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
File details
Details for the file SQLAlchemy-UTCDateTime-1.0.4.tar.gz
.
File metadata
- Download URL: SQLAlchemy-UTCDateTime-1.0.4.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a1cad8106d41feb7659c623b33e743981136f3abd9d30ee697d205b0c606687 |
|
MD5 | 0416bda9c2b6741cdc769f4faf290eb0 |
|
BLAKE2b-256 | 5c42bb3e6d24059f4d74a31da6b8f65f1641f0361e193b31d514fc13c2849d8e |