Skip to main content

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

SQLAlchemy-UTCDateTime-1.0.4.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file SQLAlchemy-UTCDateTime-1.0.4.tar.gz.

File metadata

File hashes

Hashes for SQLAlchemy-UTCDateTime-1.0.4.tar.gz
Algorithm Hash digest
SHA256 8a1cad8106d41feb7659c623b33e743981136f3abd9d30ee697d205b0c606687
MD5 0416bda9c2b6741cdc769f4faf290eb0
BLAKE2b-256 5c42bb3e6d24059f4d74a31da6b8f65f1641f0361e193b31d514fc13c2849d8e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page