diff --git a/snuba/admin/clickhouse/system_queries.py b/snuba/admin/clickhouse/system_queries.py index b46c5d40af..72f2746110 100644 --- a/snuba/admin/clickhouse/system_queries.py +++ b/snuba/admin/clickhouse/system_queries.py @@ -93,7 +93,7 @@ def _run_sql_query_on_host( (SYSTEM) \s (?!SHUTDOWN\b)(?!KILL\b) - [\w\s]+ + [\w\s'\-_]+ ;? # Optional semicolon $ """, @@ -104,7 +104,7 @@ def _run_sql_query_on_host( r"""^ (OPTIMIZE\sTABLE) \s - [\w\s]+ + [\w\s_\-']+ ;? # Optional semicolon $ """, diff --git a/tests/admin/test_system_queries.py b/tests/admin/test_system_queries.py index b346c44708..231d602905 100644 --- a/tests/admin/test_system_queries.py +++ b/tests/admin/test_system_queries.py @@ -110,6 +110,7 @@ def test_invalid_system_query(sql_query: str) -> None: ("SYSSSSSSSTEM DO SOMETHING", False), ("SYSTEM STOP MERGES", True), ("SYSTEM STOP TTL MERGES", True), + ("SYSTEM STOP TTL MERGES ON CLUSTER 'snuba-spans'", True), ("KILL MUTATION WHERE mutation_id='0000000000'", True), ("system STOP MerGes", True), ("system SHUTDOWN", False),