Expand description
SQL schema and statement constants for the SQLite checkpoint saver.
SQLite-specific notes:
- Uses
TEXTfor JSON columns (SQLite has no native JSONB;json_extract()handles filtering). - Uses
BLOBfor binary payloads (PostgresBYTEA). - Bind parameters use
?placeholders. - WAL mode is enabled at connection setup for concurrent reads.
Constants§
- INSERT_
CHECKPOINT_ WRITES_ SQL - Insert checkpoint writes (ignore on conflict). Default for normal per-task writes which should be append-only.
- MIGRATIONS
- SQL migrations for the checkpoint schema. Applied in order; each
migration’s index is recorded in
checkpoint_migrations.v. - SELECT_
BLOBS_ SQL - Fetch all blobs (channel values) for a given checkpoint by joining
checkpoint.channel_versionswith the blobs table. - SELECT_
CHECKPOINT_ SQL - Select base columns for a checkpoint row. Channel values and pending
writes are fetched separately (SQLite lacks
array_agg). - SELECT_
WRITES_ SQL - Fetch pending writes for a given checkpoint, ordered by task and idx.
- UPSERT_
CHECKPOINTS_ SQL - Upsert a checkpoint, replacing the JSON payload and metadata if the (thread, ns, id) tuple already exists.
- UPSERT_
CHECKPOINT_ BLOBS_ SQL - Upsert checkpoint blobs. Blobs are immutable per (channel, version), so on conflict we keep the existing row.
- UPSERT_
CHECKPOINT_ WRITES_ SQL - Upsert checkpoint writes (overwrite on conflict). Used for special
channels like
__error__whose value may legitimately change.