// the find
onecodex/chrononaut
A history mixin with audit logging, record locking, and time travel for FlaskSQLAlchemy
Chrononaut is a Flask-SQLAlchemy mixin that bolts on audit history tables, optimistic-ish record locking, and point-in-time 'time travel' queries for Postgres-backed models. It's aimed at teams that need an audit trail (who changed what, when, and optionally why) without rolling their own versioning tables from scratch.
The rationale context manager is a genuinely useful detail — most audit libraries capture the diff but not the why, and stashing that in chrononaut_meta['extra_info'] is a clean way to do it without a schema change. It also ships a real migration path (HistoryModelDataConverter) for moving off the old 0.2 history-table shape, including a chunked mode for large tables, which suggests the author actually hit that problem in production rather than hand-waving it. CI is proper for a project this size: GitHub Actions running tests plus a separate pre-commit workflow enforcing black/flake8, with codecov wired in.
19 stars, 4 forks, and a last push in March 2025 — this is a one-shop (onecodex) internal tool open-sourced, not something with a community behind it, so expect to read source when you hit an edge case rather than finding a Stack Overflow answer. It's hard-locked to Postgres and Flask-SQLAlchemy >= 2.2; the README itself says 'future plans include extending support for SQLAlchemy more generally' which is a tell that the abstraction boundary is currently Flask-shaped, not SQLAlchemy-shaped — painful if you're on plain SQLAlchemy or a different web framework. The migration tooling between the 0.2 and 0.3 history table formats is a strong signal the internal schema has already changed once in ways that weren't backward compatible, so adopting this means some risk of another breaking schema migration down the line. Record locking and time travel are mentioned in the pitch but the README gives zero code examples for either — you have to go to the Read the Docs site (or the source) to find out how they actually work.