Skip to content

Add CatalogStorage protocol and SQLite implementation#31

Merged
rustyconover merged 4 commits into
mainfrom
feature/catalog-storage
Jan 6, 2026
Merged

Add CatalogStorage protocol and SQLite implementation#31
rustyconover merged 4 commits into
mainfrom
feature/catalog-storage

Conversation

@rustyconover

Copy link
Copy Markdown
Contributor

Summary

  • Add CatalogStorage protocol for catalog state persistence
  • Add CatalogStorageSqlite implementation with SQLite backend
  • Add exports to vgi.catalog module

CatalogStorage Protocol

  • attach_put/get/delete/list - Manage attachment state (attach_id → catalog_name, options)
  • transaction_put/get/delete - Manage transaction state (transaction_id → attach_id, state)

CatalogStorageSqlite Features

  • SQLite-backed storage with WAL mode for concurrent access
  • Default location: ~/.state/vgi/vgi_catalog.db
  • JSON serialization for options dictionary
  • Cascade delete of transactions when attachment is deleted
  • ID generation helpers: generate_attach_id(), generate_transaction_id()
  • Cleanup utilities for old entries

Test Coverage

  • 19 new tests for storage functionality
  • All 763 tests pass

Test plan

  • All 763 tests pass
  • mypy passes with no issues
  • ruff check and format pass

🤖 Generated with Claude Code

rustyconover and others added 4 commits January 5, 2026 20:20
Implement optional storage layer for catalog attach_id and transaction_id
persistence:

CatalogStorage protocol:
- attach_put/get/delete/list - Manage attachment state
- transaction_put/get/delete - Manage transaction state

CatalogStorageSqlite implementation:
- SQLite-backed storage with WAL mode for concurrent access
- Default location: ~/.state/vgi/vgi_catalog.db
- JSON serialization for options
- Cascade delete of transactions when attachment is deleted
- ID generation helpers (generate_attach_id, generate_transaction_id)
- Cleanup utilities for old entries

Adds 19 new tests for storage functionality.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create CatalogClientMixin with all catalog operations:
  - Core infrastructure (_catalog_invoke, _catalog_invoke_stream)
  - Catalog lifecycle methods (catalogs, attach, detach, create, drop, version)
  - Transaction methods (begin, commit, rollback)
  - Schema methods (schemas, get, create, drop, contents)
  - Table methods (get, create, drop, rename, comment_set, column operations)
  - View methods (get, create, drop, rename, comment_set)
- Integrate mixin into Client class
- Delete standalone CatalogClient in favor of unified Client
- Update exports in vgi/client/__init__.py
- Fix worker to handle 0-row batches for no-arg methods
- Fix worker to serialize list of primitives (e.g., catalogs())
- Add tests for Client catalog methods

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Expose catalog API via CLI subcommands:
- catalog list/attach/detach/create/drop/version
- schema list/get/create/drop/contents
- table get/create/drop/rename/comment/scan-function + column ops
- view get/create/drop/rename/comment
- transaction begin/commit/rollback

Refactored cli.py from @click.command to @click.group with
invoke_without_command=True to preserve backward-compatible
function invocation (--function) while adding subcommands.

Added transaction methods and TransactionBeginResult to
CatalogClientMixin for transaction support.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rustyconover rustyconover merged commit b24082d into main Jan 6, 2026
0 of 16 checks passed
@rustyconover rustyconover deleted the feature/catalog-storage branch January 6, 2026 02:37
@rustyconover rustyconover restored the feature/catalog-storage branch January 6, 2026 02:37
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