Skip to main content

simple_module_audit_log

Automatic field-level audit trail for all SQLModel entities in simple_module apps. Every create / update / delete / soft-delete is captured in the audit_log_audit_entry table with the changed fields, the user who made the change, and the request correlation id — no instrumentation required in module code.

Install

pip install simple_module_audit_log

Add simple_module_audit_log to your host's dependencies and the entry point will be discovered automatically.

What it provides

  • Two-phase capture (before_flush snapshots diffs, after_flush_postexec resolves DB-assigned primary keys) so integer-PK entities record the real id, not the empty string.
  • AuditEntry SQLModel table with indexed entity_type, entity_id, user_id, created_at columns.
  • GET /api/audit_log/ REST endpoint with entity_type, entity_id, action, user_id, from_date, to_date, paging filters.
  • /audit_log Inertia browse page with the same filter set rendered as a table, gated by the audit_log.view permission.
  • Opt-outs: set __audit_exclude__ = True on a model to skip it entirely, or __audit_exclude_fields__ = {"password_hash"} to skip specific columns. AuditMixin / SoftDeleteMixin bookkeeping fields are excluded automatically.

Usage

Install the module and grant the audit_log.view permission to your admin role. Audit entries appear automatically for every entity that does not opt out.

To exclude a sensitive column:

from typing import ClassVar
from sqlmodel import Field
from simple_module_db.base import create_module_base
from simple_module_db.mixins import AuditMixin

Base = create_module_base("auth")


class Credential(Base, AuditMixin, table=True):
    __audit_exclude_fields__: ClassVar[set[str]] = {"password_hash"}

    id: int | None = Field(default=None, primary_key=True)
    user_id: str
    password_hash: str

To opt a whole table out:

class Cache(Base, table=True):
    __audit_exclude__ = True
    ...

License

MIT

Metadata

Release files for simple-module-audit-log 0.0.35

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-module-audit-log 0.0.35
File Size Uploaded Provenance
simple_module_audit_log-0.0.35.tar.gz 47.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-module-audit-log 0.0.35
File Interpreter ABI Platform
simple_module_audit_log-0.0.35-py3-none-any.whl Python 3 none any Details

Total release size: 88.3 kB

Release files / simple_module_audit_log-0.0.35.tar.gz

Download URL simple_module_audit_log-0.0.35.tar.gz
Size 47.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7752205ae1626e7af74fc50b2eeea706390500d8c927ddd78b04bad5dbb116b1
BLAKE2b-256 checksum
How to use checksums
66c2e73406d2e1d20b08da95e92477b97631558573c69cfab488bee41299c98b
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 Oct 1, 2026.

Transparency log

Release files / simple_module_audit_log-0.0.35-py3-none-any.whl

Download URL simple_module_audit_log-0.0.35-py3-none-any.whl
Size 41.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e34afe1b0ec634a6b0682c80cca3b1d03210b8e4ad5f824c85dc9f77d3708b0
BLAKE2b-256 checksum
How to use checksums
fdef059038c849333694063582f5e80be9927a02a4447de0ada90c55209499e2
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 Oct 1, 2026.

Transparency log

Security for simple-module-audit-log 0.0.35

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for simple_module_audit_log-0.0.35.tar.gz

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 Oct 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page