feat(dev_tools): enhance SQL Query Tool — clear, copy, history, edit, hardening
All checks were successful
CI / ruff (push) Successful in 15s
CI / pytest (push) Successful in 2h42m26s
CI / validate (push) Successful in 34s
CI / dependency-scanning (push) Successful in 34s
CI / docs (push) Successful in 54s
CI / deploy (push) Successful in 1m43s

UI: add Clear and Copy-to-clipboard (TSV) buttons, an in-page Recent
Queries pane (localStorage, capped at 20, de-duped) and a pencil-edit
flow for saved queries with a dedicated SQL field in the modal.
Bind Ctrl/Cmd+S to open the save modal (or edit the active saved query).

Backend: harden validate_query with a multi-statement guard that
respects string literals + comments. Stop swallowing record_query_run
errors silently — log via logger.exception so failures show up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-17 11:24:40 +02:00
parent 64a178f45d
commit e94b6d07bb
5 changed files with 268 additions and 18 deletions

View File

@@ -53,3 +53,16 @@ class TestValidateQuery:
def test_select_with_where(self):
validate_query("SELECT id, email FROM users WHERE is_active = true")
def test_trailing_semicolon_allowed(self):
validate_query("SELECT 1;")
def test_multi_statement_rejected(self):
with pytest.raises(QueryValidationError, match="Multiple statements"):
validate_query("SELECT 1; SELECT 2")
def test_semicolon_in_string_literal_allowed(self):
validate_query("SELECT ';' AS sep")
def test_semicolon_in_comment_allowed(self):
validate_query("SELECT 1 -- end; second\nFROM dual")