SQLAlchemy-Continuum
Versioning and auditing extension for SQLAlchemy.
Features
Creates versions for inserts, deletes and updates
Does not store updates which don’t change anything
Supports alembic migrations
Can revert objects data as well as all object relations at given transaction even if the object was deleted
Transactions can be queried afterwards using SQLAlchemy query syntax
Query for changed records at given transaction
Temporal relationship reflection. Version object’s relationship show the parent objects relationships as they where in that point in time.
Supports native versioning for PostgreSQL database (trigger based versioning)
QuickStart
pip install SQLAlchemy-Continuum
In order to make your models versioned you need two things:
Call make_versioned() before your models are defined.
Add __versioned__ to all models you wish to add versioning to
import sqlalchemy as sa
from sqlalchemy_continuum import make_versioned
make_versioned(user_cls=None)
class Article(Base):
__versioned__ = {}
__tablename__ = 'article'
id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
name = sa.Column(sa.Unicode(255))
content = sa.Column(sa.UnicodeText)
article = Article(name='Some article', content='Some content')
session.add(article)
session.commit()
# article has now one version stored in database
article.versions[0].name
# 'Some article'
article.name = 'Updated name'
session.commit()
article.versions[1].name
# 'Updated name'
# lets revert back to first version
article.versions[0].revert()
article.name
# 'Some article'
For completeness, below is a working example.
from sqlalchemy_continuum import make_versioned
from sqlalchemy import Column, Integer, Unicode, UnicodeText, create_engine
from sqlalchemy.orm import Session, configure_mappers, declarative_base
make_versioned(user_cls=None)
Base = declarative_base()
class Article(Base):
__versioned__ = {}
__tablename__ = 'article'
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(Unicode(255))
content = Column(UnicodeText)
configure_mappers()
engine = create_engine('sqlite://')
Base.metadata.create_all(engine)
session = Session(engine)
article = Article(name='Some article', content='Some content')
session.add(article)
session.commit()
article.versions[0].name
article.name = 'Updated name'
session.commit()
article.versions[1].name
article.versions[0].revert()
article.name
Resources
More information
Metadata
Release files for SQLAlchemy-Continuum 1.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqlalchemy_continuum-1.8.0.tar.gz | 96.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqlalchemy_continuum-1.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 150.4 kB
Release files / sqlalchemy_continuum-1.8.0.tar.gz
| Download URL | sqlalchemy_continuum-1.8.0.tar.gz |
|---|---|
| Size | 96.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8ed24dbe608df9da3fff63070ab64e2179698186e8c7a5aaea9105aa7abf5ae
|
|
BLAKE2b-256 checksum How to use checksums |
343d1e5d4b541b9f61219038782f2b365bb272d7aa42678f273524d62ddab5ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logRelease files / sqlalchemy_continuum-1.8.0-py3-none-any.whl
| Download URL | sqlalchemy_continuum-1.8.0-py3-none-any.whl |
|---|---|
| Size | 54.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5e83ddef5306cc8ee9ece6550298ea52673a9b5194ebfe96ebfc1170e573820
|
|
BLAKE2b-256 checksum How to use checksums |
00eadba14ed4986536528722fd47af8e74cfa8a0c802084b6d3a7e9ef6658e0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency log