feat: add SQLite schema adapter#9
Open
wondr-wclabs wants to merge 1 commit into
Open
Conversation
4350eb3 to
d06ff16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds the first database-adapter slice for #4: keep Postgres as the reference implementation, introduce backend selection by DSN, and add SQLite support without adding any new runtime dependency.
I intentionally kept MySQL out of this PR. SQLite is available through the Python standard library, so it exercises the adapter shape without forcing a driver decision. MySQL can now be added as a follow-up optional-extra implementation against the same
Schema/Table/Column/ForeignKeymodel.What changed
SQLiteDatabaseandmake_database()sosqlite:///local.dbroutes through a SQLite backend while existing Postgres DSNs keep the currentDatabasepath.mode=roand also enablePRAGMA query_only = ON, preserving the two-layer read-only model used by Postgres.pg_catalogmapping.sqlite_schema, columns fromPRAGMA table_xinfo, and foreign keys fromPRAGMA foreign_key_list.sqlglotvalidation instead of hard-coding Postgres.Validation
.venv/bin/python -m pytest tests/test_schema_adapters.py tests/test_safety.py -q-> 26 passed.venv/bin/python -m pytest -q-> 55 passed.venv/bin/python -m promptquery --helpgit diff --check