--- id: sqlalchemy-utc version: "0.14.0" license: MIT License license_treatment: permissive maintenance: abandoned --- # SQLAlchemy-Utc — SQLAlchemy type to store aware datetime values License: permissive · Maintenance: abandoned · Downloads: 198.0K/mo ## What it is and what it does SQLAlchemy-Utc solves the problem of inconsistent timezone handling across different database backends. SQLAlchemy's built-in DateTime type with timezone support works well on databases like PostgreSQL that have native timestamptz types, but fails silently on SQLite and MySQL, which lack native timezone support. This package provides a drop-in UtcDateTime replacement that normalizes behavior: it accepts only aware datetime objects, converts them to UTC before storage, and always returns aware UTC datetimes from queries, regardless of the underlying database. The package also includes a utcnow() helper function as a server-side alternative to func.now() for setting default timestamps. It's designed for applications that need consistent, predictable datetime handling across multiple database backends without manual UTC conversion logic in application code. Use it for: - Store event timestamps consistently across SQLite development and PostgreSQL production databases - Ensure all datetime values in a multi-database application are UTC-normalized without application-level conversion - Set server-side default timestamps using utcnow() that work identically on SQLite, MySQL, and PostgreSQL - Build timezone-aware ORM models that return aware datetime objects from all query results - Migrate applications from naive to timezone-aware datetimes while maintaining database compatibility ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a SQLAlchemy DateTime type that consistently handles timezone-aware datetimes across database vendors, storing all values in UTC and returning aware datetime objects regardless of whether the underlying database supports native timezone types. Yes, with conditions. The package solves a real cross-database datetime problem and has no security vulnerabilities. However, it is abandoned (last commit August 2022, no activity for nearly four years) and only explicitly supports Python up to 3.9. Install it if you need consistent UTC datetime handling across SQLite/MySQL and PostgreSQL and are willing to maintain it yourself or pin to a stable SQLAlchemy version; avoid it if you require active maintenance or support for the latest Python versions. ## Install pip install sqlalchemy-utc uv add sqlalchemy-utc poetry add sqlalchemy-utc ## Installing SQLAlchemy-Utc Before you install: Low install friction with just two runtime dependencies (setuptools and SQLAlchemy). Package is abandoned as of August 2022 with no commits for nearly four years, though the repository remains public and the last release (0.14.0) added Pandas compatibility. License in practice: MIT License permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects. Quickstart: from sqlalchemy import Column, Integer, create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy_utc import UtcDateTime, utcnow Base = declarative_base() class Event(Base): __tablename__ = 'events' id = Column(Integer, primary_key=True) created_at = Column(UtcDateTime(), default=utcnow()) Verify before relying: - Whether the package works reliably with current SQLAlchemy versions (last release was September 2021, no maintenance since) - Compatibility with Python 3.10+ (classifiers only list up to 3.9) - Whether millisecond precision on SQLite (added in 0.13.0) handles all edge cases correctly ## Package facts - License: MIT License (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 198.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sqlalchemy datetime timezone, utc datetime sqlalchemy, timezone aware database column, sqlalchemy sqlite mysql utc, database datetime normalization, aware datetime sqlalchemy type, cross-database timezone handling, timezone-handling, cross-database, abandoned-but-stable [View on SkillFed](https://skillfed.io/packages/sqlalchemy-utc) · [View on PyPI](https://pypi.org/project/sqlalchemy-utc/)