-
Notifications
You must be signed in to change notification settings - Fork 968
feat(sqlite): Add database analyzer using ncruces/go-sqlite3 #4199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kyleconroy
merged 8 commits into
main
from
claude/add-sqlite-analyzer-01DeQ9Y85DroTibtAdBZRNHw
Nov 29, 2025
Merged
feat(sqlite): Add database analyzer using ncruces/go-sqlite3 #4199
kyleconroy
merged 8 commits into
main
from
claude/add-sqlite-analyzer-01DeQ9Y85DroTibtAdBZRNHw
Nov 29, 2025
Conversation
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
Add a SQLite database analyzer that uses the ncruces/go-sqlite3 library, which is a pure Go SQLite implementation using WebAssembly (no CGO required). The analyzer provides column and parameter type information by: - Connecting to a SQLite database (in-memory for managed databases) - Preparing SQL statements to extract metadata - Returning column names, types, and table information - Returning parameter information Changes: - Add internal/engine/sqlite/analyzer/analyze.go with the Analyzer implementation - Add internal/engine/sqlite/analyzer/analyze_test.go with tests - Wire the analyzer into internal/compiler/engine.go for SQLite engine - Update internal/endtoend/endtoend_test.go to enable managed databases for SQLite - Add github.com/ncruces/go-sqlite3 dependency Co-Authored-By: Claude <noreply@anthropic.com>
Replace the modernc.org/sqlite driver with ncruces/go-sqlite3 driver throughout the codebase. This provides a consistent SQLite implementation using a single library (ncruces/go-sqlite3) which is pure Go and uses WebAssembly, requiring no CGO. Changes: - Replace modernc.org/sqlite imports with ncruces/go-sqlite3/driver - Rename vet_modernc.go to vet_sqlite.go - Rename sqlite_modernc.go to sqlite.go - Remove modernc.org/sqlite and its dependencies from go.mod - Make github.com/ncruces/go-sqlite3 a direct dependency Co-Authored-By: Claude <noreply@anthropic.com>
Clean up go.mod and go.sum after replacing modernc.org/sqlite with ncruces/go-sqlite3. Removes unused indirect dependencies. Co-Authored-By: Claude <noreply@anthropic.com>
The previous refactor accidentally removed the SQLite and CreateSQLiteDatabase functions from sqltest/sqlite.go, breaking example tests. This restores the functions while using the correct "sqlite3" driver name for ncruces/go-sqlite3. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The original sqlite.go on main had no build constraint. The ncruces/go-sqlite3 driver works differently from modernc.org/sqlite (it uses embedded WASM internally), so the !wasm constraint is not needed for test code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Apply migrations for in-memory SQLite databases in both the analyzer and vet command, since they start empty and need schema setup - Preserve catalog-inferred column/parameter types when the database analyzer returns "any" (SQLite doesn't provide type info for parameters) - Change driver name from "sqlite" to "sqlite3" for ncruces/go-sqlite3 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The SQLite database analyzer now validates queries against real SQLite, revealing several issues in test files: - builtins: Remove sqlite_offset (not available in standard SQLite) - ddl_create_trigger: Add missing tables referenced by trigger - insert_select_invalid: Separate schema from query, update error message - invalid_group_by_reference: Separate schema from query, update error message - invalid_table_alias: Fix INT to INTEGER, separate schema, update error - join_left_same_table: Fix authors.parent_id to a.parent_id (use alias) - limit: Remove UPDATE/DELETE LIMIT (requires special compile option) - quoted_names_complex: Fix UPDATE referencing renamed table - select_exists: Change INT to INTEGER for AUTOINCREMENT - select_not_exists: Fix whitespace, detect parameter - sqlc_embed: Use :memory: for ATTACH, fix u.users.id to u.id Tests with different error messages in base vs managed-db contexts now have exec.json files limiting them to managed-db context only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Add a SQLite database analyzer that uses the ncruces/go-sqlite3 library,
which is a pure Go SQLite implementation using WebAssembly (no CGO required).
The analyzer provides column and parameter type information by:
Changes:
Co-Authored-By: Claude noreply@anthropic.com