skillfed

SQLAlchemy-Continuum

Versioning and auditing extension for SQLAlchemy.

sqlalchemy-continuum v1.7.0 990.5K downloads/30d#4,562 on PyPI644
Permissive license BSD-3-Clause Active released

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 on this page — 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

sqlalchemy-continuum on PyPI

pip

pip install sqlalchemy-continuum

uv

uv add sqlalchemy-continuum

poetry

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 the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — SQLAlchemy
Maintenance actively maintained — 42 days since the last release
Last repo commit
First released
Downloads 990,524/month — #4,562 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sqlalchemy_continuum-1.7.0-py3-none-any.whl

Environment :: Web EnvironmentIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Libraries :: Python Modules

Tags

sqlalchemy versioningdatabase audit trailtrack model changessqlalchemy historytemporal data queriesrevert database changeschange data capture
audit-trailtemporal-queriesorm-extension

More Python Modules packages