Skip to content

SQLite adapter

The adapter is imported explicitly and remains outside the core import path:

from kazeflow.sqlite_store import SQLiteRunStore

with SQLiteRunStore("runs.sqlite3") as store:
    saved = store.save(result)
    loaded = store.load(result.run_id)
    recent = store.list_runs(limit=10)

Constructing a store creates or initializes schema version 1. It stores portable records, not reconstructed in-memory RunResult objects.

The database layout version is independent of the portable record version. Schema version 1 can contain record v1, v2, v3, and v4 rows; new saves use record v4 and do not rewrite older rows. StoredRunRecord.schema_version identifies the record version for that row. Record v4 retains successful resolution and materialization IDs; loading history does not contact an adapter or load artifacts. IDs are opaque application-defined diagnostic metadata and are not automatically redacted.

SQLiteRunStore

SQLiteRunStore

A caller-owned SQLite database of versioned portable run records.

A new or empty database initializes to schema version 1. A non-empty database with PRAGMA user_version = 0 is rejected as unversioned; a malformed or non-SQLite file raises the underlying :class:sqlite3.DatabaseError before any record is written. Future-version databases are rejected before mutation.

schema_version property

Return the current database schema version.

close()

Close the caller-owned database connection; this operation is idempotent.

list_runs(*, limit=None)

List run metadata in deterministic saved-time then run-id order.

load(run_id)

Load a persistent portable record without rebuilding a RunResult.

save(result)

Persist one completed result without retaining in-memory-only values.

StoredRunRecord

StoredRunRecord dataclass

Bases: StoredRunSummary

An immutable envelope around a freshly decoded portable run record.

record property

Return a new decoded copy of the portable, deliberately lossy record.

StoredRunSummary

StoredRunSummary dataclass

Deterministic metadata for a run listed from :class:SQLiteRunStore.