Skip to content

SQLite and migrations API

Stores

sqlite

File-backed SQLite store for local and bounded single-writer deployments.

SQLiteActionStore

SQLiteActionStore(database: str | PathLike[str], *, lock_timeout_seconds: float = 30.0)

Bases: _SQLiteStoreBase, ActionStore

Durable adapter for local, evaluation, and bounded single-writer use.

create async

create(proposal: StoredProposal) -> None

get async

get(tenant_reference: str, proposal_reference: str) -> StoredProposal | None

compare_and_set async

compare_and_set(*, tenant_reference: str, proposal_reference: str, expected_revision: int, expected_statuses: tuple[LifecycleStatus, ...], updated: StoredProposal) -> bool

admit_execution async

admit_execution(*, tenant_reference: str, proposal_reference: str, expected_revision: int, admitted_at: datetime, updated: StoredProposal) -> EffectClaimResult

get_effect_claim_owner async

get_effect_claim_owner(*, tenant_reference: str, action_type: ActionType, semantic_effect_reference: str) -> str | None

SQLiteRetentionStore

SQLiteRetentionStore(database: str | PathLike[str], *, lock_timeout_seconds: float = 30.0)

Bases: _SQLiteStoreBase, RetentionStore

Erasure adapter sharing a file with SQLiteActionStore without DB roles.

mark_erasure_pending async

mark_erasure_pending(*, tenant_reference: str, proposal_reference: str, expected_revision: int, pending_at: datetime) -> bool

complete_erasure async

complete_erasure(*, tenant_reference: str, proposal_reference: str, expected_revision: int, erased_at: datetime) -> bool

SQLiteStoredDataCorruptionError

Bases: RuntimeError

Stored SQLite proposal data disagrees with the public model contract.

Migration runner

sqlite_migrations

Explicit, file-backed migrations for the bounded SQLite adapter.

SQLiteMigrationStatus dataclass

SQLiteMigrationStatus(applied_versions: tuple[int, ...], pending_versions: tuple[int, ...])

applied_versions instance-attribute

applied_versions: tuple[int, ...]

pending_versions instance-attribute

pending_versions: tuple[int, ...]

SQLiteMigrationStateError

Bases: RuntimeError

The on-disk migration history cannot be used by this library version.

inspect_sqlite async

inspect_sqlite(database: str | PathLike[str]) -> SQLiteMigrationStatus

Inspect a file without creating or changing it.

migrate_sqlite async

migrate_sqlite(database: str | PathLike[str], *, lock_timeout: timedelta = timedelta(seconds=30)) -> SQLiteMigrationStatus

Apply packaged migrations under one SQLite write transaction.

sqlite_migration_compatibility

sqlite_migration_compatibility() -> tuple[MigrationCompatibility, ...]

Return immutable compatibility metadata for SQLite migrations.