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.3.tar.gz (2.4 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for SQLAlchemy-UTCDateTime-1.0.3.tar.gz
Algorithm Hash digest
SHA256 02d3e42f82e2a78632d66cfd9d64bc8e350a0ecf378d48deaa009df9004f7507
MD5 2aac08c7d6e3120e2dae5cc803a3cc98
BLAKE2b-256 6c430ed5e68d13beafc575312efcc162dbbe50664e67e6e70aa83be141696550

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