Skip to content

feat(adapters): add the SQLite metadata store - #7

Merged
UltiPro merged 1 commit into
mainfrom
feat/sqlite-metadata-store
Nov 11, 2026
Merged

UltiPro merged 1 commit into
mainfrom
feat/sqlite-metadata-store

Conversation

@UltiPro

@UltiPro UltiPro commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the first implementation of the MetadataStore port: a local store in one SQLite file, so models, versions, runs and aliases can be saved and read back. It uses sqlite3 from the standard library, so there is no new dependency.

  • adapters/local/schema.py: tables models, versions, runs and aliases, with the schema version in PRAGMA user_version.
  • Opening a store applies the missing migrations in one transaction. An older store is first copied to metadata.db.v<N>.bak, and a store with a newer schema is refused with IncompatibleStoreError.
  • adapters/local/metadata.py: SqliteMetadataStore. Params, metrics and the signature of a run are JSON text in the run row, so a NaN metric survives.
  • The database guards the rules that must never break: a version number is unique per model, a released version points at one of its own runs, an alias points at a version of its own model, and removing a draft removes its runs.
  • ports/metadata.py: new delete_version (drafts only, with their runs) and delete_alias. A version enters the store as a draft and is released with update_version.
  • The SQL needs nothing newer than SQLite 3.24 (no STRICT tables), because Python on older Linux distributions uses the system SQLite.

Checklist

  • PR title follows Conventional Commits (e.g. feat(registry): ...)
  • Larger or architectural changes were discussed in an issue first
  • Tests added or updated (if applicable)
  • No OS-specific assumptions (paths, shell commands, file encodings); works on Linux, macOS and Windows
  • Documentation updated (n/a: the store is not reachable from the CLI yet, so nothing user-facing changed)
  • CHANGELOG.md updated under "Unreleased"

@UltiPro
UltiPro merged commit 2c508a8 into main Nov 11, 2026
16 checks passed
@UltiPro
UltiPro deleted the feat/sqlite-metadata-store branch November 11, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant