mirror of
https://github.com/apache/superset.git
synced 2026-07-14 02:35:44 +00:00
fix(sql): strip trailing statement terminator in sanitize_clause
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3148,6 +3148,10 @@ def test_is_valid_cvas(sql: str, engine: str, expected: bool) -> None:
|
||||
), # Block comments preserved
|
||||
("col = 'col1 = 1) AND (col2 = 2'", "col = 'col1 = 1) AND (col2 = 2'", "base"),
|
||||
("col = 'select 1; select 2'", "col = 'select 1; select 2'", "base"),
|
||||
# Trailing statement terminators are stripped so the clause stays valid
|
||||
# once embedded inside a larger fragment (e.g. ``WHERE (...)``).
|
||||
("col = 1;", "col = 1", "base"),
|
||||
("col = 1 ; ", "col = 1", "base"),
|
||||
("col = 'abc -- comment'", "col = 'abc -- comment'", "base"),
|
||||
("col1 = 1) AND (col2 = 2)", QueryClauseValidationException, "base"),
|
||||
("(col1 = 1) AND (col2 = 2", QueryClauseValidationException, "base"),
|
||||
|
||||
Reference in New Issue
Block a user