All Projects → spoqa → sqlalchemy-utc

spoqa / sqlalchemy-utc

Licence: MIT license
SQLAlchemy type to store aware datetime values

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to sqlalchemy-utc

Anydate
Swifty Date & Time API inspired from Java 8 DateTime API.
Stars: ✭ 178 (+104.6%)
Mutual labels:  datetime, timezone
SQL-for-Data-Analytics
Perform fast and efficient data analysis with the power of SQL
Stars: ✭ 187 (+114.94%)
Mutual labels:  sqlalchemy, datetime
Node Geo Tz
A node.js module to find the timezone based on gps coordinates
Stars: ✭ 181 (+108.05%)
Mutual labels:  datetime, timezone
Luatz
Time, Date and Timezone library for lua
Stars: ✭ 92 (+5.75%)
Mutual labels:  datetime, timezone
bonobo-sqlalchemy
PREVIEW - SQL databases in Bonobo, using sqlalchemy
Stars: ✭ 23 (-73.56%)
Mutual labels:  sqlalchemy, databases
Delorean
Delorean: Time Travel Made Easy
Stars: ✭ 1,793 (+1960.92%)
Mutual labels:  datetime, timezone
Soulvercore
A powerful Swift framework for evaluating mathematical expressions
Stars: ✭ 245 (+181.61%)
Mutual labels:  datetime, timezone
Date
A date and time library based on the C++11/14/17 <chrono> header
Stars: ✭ 2,389 (+2645.98%)
Mutual labels:  datetime, timezone
pydbantic
A single model for shaping, creating, accessing, storing data within a Database
Stars: ✭ 137 (+57.47%)
Mutual labels:  sqlalchemy, databases
sqlalchemy-enum34
SQLAlchemy type to store standard enum.Enum values
Stars: ✭ 47 (-45.98%)
Mutual labels:  sqlalchemy, databases
Dateutils
nifty command line date and time utilities; fast date calculations and conversion in the shell
Stars: ✭ 458 (+426.44%)
Mutual labels:  datetime, timezone
Ormar
python async mini orm with fastapi in mind and pydantic validation
Stars: ✭ 155 (+78.16%)
Mutual labels:  sqlalchemy, databases
nepali-datetime
Python's core datetime inspired nepali datetime (BS date & NPT) package 🇳🇵
Stars: ✭ 36 (-58.62%)
Mutual labels:  datetime, timezone
Time
Building a better date/time library for Swift
Stars: ✭ 1,983 (+2179.31%)
Mutual labels:  datetime, timezone
hs-hourglass
efficient and simpler time API for haskell
Stars: ✭ 43 (-50.57%)
Mutual labels:  datetime, timezone
nim-gatabase
Connection-Pooling Compile-Time ORM for Nim
Stars: ✭ 103 (+18.39%)
Mutual labels:  sqlalchemy, databases
Sqlalchemy Imageattach
SQLAlchemy extension for attaching images to entities.
Stars: ✭ 107 (+22.99%)
Mutual labels:  sqlalchemy, databases
Awesome Sqlalchemy
A curated list of awesome tools for SQLAlchemy
Stars: ✭ 2,316 (+2562.07%)
Mutual labels:  sqlalchemy, databases
sqli
A Laravel Artisan SQL Interactive Interface
Stars: ✭ 60 (-31.03%)
Mutual labels:  databases
awesome-backend
🚀 A curated and opinionated list of resources (English & Russian) for Backend developers | Структурированный список ресурсов для изучения Backend разработки
Stars: ✭ 826 (+849.43%)
Mutual labels:  databases

SQLAlchemy-Utc

https://badge.fury.io/py/SQLAlchemy-Utc.svg? https://travis-ci.com/spoqa/sqlalchemy-utc.svg?branch=master https://codecov.io/github/spoqa/sqlalchemy-utc/coverage.svg?branch=master

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 them, and returns always aware datetime.datetime values 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.

A SQLAlchemy helper function, utcnow(), is provided as an alternative to func.now() for generating UtcDateTime values on the server. For example: Column('time', UtcDateTime(), default=utcnow()).

Written by Hong Minhee at Spoqa, and distributed under MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].