Merged
Conversation
Extract SQL read-only detection from aws.py into a shared module at dippy/core/sql.py. The new implementation handles: - String literals (single/double quoted with escapes) - Quoted identifiers (backticks, brackets, double quotes) - Comments (single-line and block) - Multiple statement detection - CTEs (WITH clauses) - SELECT INTO as a write operation - UPSERT variants (REPLACE, ON CONFLICT, ON DUPLICATE KEY) - Dialect-specific keywords via extra_readonly/extra_write parameters Also adds verify-counts skill and updates release skill to use it.
Uses the shared SQL classification module to analyze queries. Allows read-only queries, asks for write operations. Special handling: - -readonly and -safe flags always allowed - SQLite-specific write keywords: PRAGMA, ATTACH, DETACH, VACUUM, REINDEX, ANALYZE - Interactive mode (no SQL) requires confirmation - -init script files require confirmation
Analyzes SQL passed via -e/--execute option. Allows read-only queries, asks for write operations. MySQL-specific write keyword: LOAD (for LOAD DATA) Interactive mode (no -e) requires confirmation.
Analyzes SQL passed via -c/--command options. Supports multiple -c options (all must be read-only). Allows --list/-l for listing databases. PostgreSQL-specific write keywords: COPY, VACUUM, CLUSTER, REINDEX, ANALYZE Interactive mode and file input (-f) require confirmation.
Similar to sqlite3 - supports -readonly and -safe flags. Analyzes SQL from positional args, -c, -s, and -cmd options. DuckDB-specific write keywords: PRAGMA, ATTACH, DETACH, VACUUM, COPY, EXPORT, IMPORT
Supports the modern go-sqlcmd CLI for SQL Server. Analyzes SQL in 'query' subcommand. Safe: config, open, help, completion, read-only queries Unsafe: create, install, delete, start, stop, write queries
- sqlite3: -lookaside takes TWO arguments (SIZE N), not one - duckdb: -newline and -nullvalue take arguments, not no-arg flags Added regression tests for these cases.
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
aws.pyinto shared moduledippy/core/sql.pyextra_readonly/extra_writeparametersChanges
src/dippy/core/sql.pytests/core/test_sql.pysrc/dippy/cli/aws.py.claude/skills/verify-counts/.claude/skills/release/SKILL.md