--- id: sqlalchemy-continuum version: "1.7.0" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # SQLAlchemy-Continuum — Versioning and auditing extension for SQLAlchemy. License: permissive · Maintenance: active · Downloads: 990.5K/mo ## What it is and what it does SQLAlchemy-Continuum is a versioning and auditing extension that automatically creates and stores versions of your SQLAlchemy model instances whenever they are inserted, updated, or deleted. It integrates directly into the ORM layer, so you define versioning declaratively by adding a `__versioned__` attribute to any model you want to track. Each change is recorded in a version table, and you can query the full history of any object, inspect what changed at each step, and revert objects to previous states—even if they've been deleted. The package stores only meaningful changes (skipping updates that don't alter data) and supports querying transactions and changed records using standard SQLAlchemy query syntax. It works with alembic migrations and can reflect temporal relationships, showing a parent object's related records as they existed at a specific point in time. For PostgreSQL users, it offers native trigger-based versioning as an alternative to the default approach. Use it for: - Audit compliance: maintain an immutable record of all changes to critical business entities for regulatory or forensic purposes. - Undo/revert functionality: let users restore objects to previous states without manual rollback logic. - Change analysis: query which records changed in a specific transaction or time window to understand data evolution. - Temporal reporting: reconstruct the state of your database at any historical point for historical analysis or debugging. - Soft deletes with history: keep deleted records accessible via version history while maintaining referential integrity. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. SQLAlchemy-Continuum adds automatic versioning and auditing to SQLAlchemy models, tracking all inserts, updates, and deletes with the ability to query and revert changes at any point in time. Yes. SQLAlchemy-Continuum is actively maintained, has no known vulnerabilities, and solves a common problem with minimal install friction. Use it if you need automatic versioning and audit trails for SQLAlchemy models. The BSD-3-Clause license poses no restrictions for most projects. ## Install pip install sqlalchemy-continuum uv add sqlalchemy-continuum poetry add sqlalchemy-continuum ## Installing SQLAlchemy-Continuum Before you install: Low friction: pure Python wheel with only SQLAlchemy as a runtime dependency. Actively maintained with a recent release and no known vulnerabilities. License in practice: BSD-3-Clause is permissive; you can use this in commercial and proprietary projects with minimal restrictions. Quickstart: pip install SQLAlchemy-Continuum from sqlalchemy_continuum import make_versioned from sqlalchemy import Column, Integer, Unicode, create_engine from sqlalchemy.orm import Session, declarative_base make_versioned(user_cls=None) Base = declarative_base() class Article(Base): __versioned__ = {} __tablename__ = 'article' id = Column(Integer, primary_key=True) name = Column(Unicode(255)) engine = create_engine('sqlite://') Base.metadata.create_all(engine) session = Session(engine) article = Article(name='Original') session.add(article) session.commit() article.versions[0].name # Access version history Requires Python 3.10 or later. Verify before relying: - Whether PostgreSQL trigger-based versioning performs better than the default approach for high-volume updates. - Compatibility with SQLAlchemy 2.0+ ORM features beyond basic CRUD operations. - Performance impact on large tables with many historical versions. ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 990.5K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags sqlalchemy versioning, database audit trail, track model changes, sqlalchemy history, temporal data queries, revert database changes, change data capture, audit-trail, temporal-queries, orm-extension [View on SkillFed](https://skillfed.io/packages/sqlalchemy-continuum) · [View on PyPI](https://pypi.org/project/sqlalchemy-continuum/)