MySQL and migrations API¶
Stores¶
mysql ¶
Durable MySQL 8 action and retention stores over an aiomysql-compatible pool.
MySQLActionStore ¶
MySQLActionStore(pool: MySQLConnectionSource)
Bases: _MySQLStoreBase, ActionStore
Tenant-scoped runtime store for supported MySQL 8 deployments.
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
MySQLRetentionStore ¶
MySQLRetentionStore(pool: MySQLConnectionSource)
Bases: _MySQLStoreBase, RetentionStore
Privileged erasure adapter intended for a separate MySQL credential.
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
MySQLConnectionSource ¶
Bases: Protocol
Minimum async pool contract used by the MySQL stores.
MySQLAdapterLimitError ¶
Bases: ValueError
A valid public model exceeds a documented MySQL adapter bound.
MySQLStoredDataCorruptionError ¶
Bases: RuntimeError
Stored MySQL data disagrees with the public proposal contract.
Migration runner¶
mysql_migrations ¶
Explicit migrations for the MySQL 8 action-store adapter.
MySQLMigrationStatus
dataclass
¶
MySQLMigrationStateError ¶
Bases: RuntimeError
The connected server or migration history is incompatible.
MySQLConnectionSource ¶
Bases: Protocol
Minimum pool contract used by migration and store adapters.
check_mysql_readiness
async
¶
check_mysql_readiness(pool: MySQLConnectionSource, *, lane: DatabaseAccessLane) -> DatabaseReadiness
Check migration history and exact direct grants without writes.
inspect_mysql
async
¶
inspect_mysql(pool: MySQLConnectionSource) -> MySQLMigrationStatus
Inspect migration state without creating or changing database objects.
migrate_mysql
async
¶
migrate_mysql(pool: MySQLConnectionSource, *, lock_timeout: timedelta = timedelta(seconds=30), writers_quiesced: bool = False) -> MySQLMigrationStatus
Apply packaged migrations while holding a database-scoped advisory lock.
mysql_migration_compatibility ¶
mysql_migration_compatibility() -> tuple[MigrationCompatibility, ...]
Return immutable compatibility metadata for MySQL migrations.
render_mysql_grants ¶
render_mysql_grants(*, database: str, runtime_user: str, runtime_host: str, retention_user: str, retention_host: str) -> str
Render the official least-privilege runtime and retention grants.
See Migration compatibility before automating an upgrade. Contract migrations on an existing schema require an explicit writer quiescence acknowledgement.
See Database readiness for the read-only startup gate.