Skip to content
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

ref(admin): Allow clusterAllReplicas in system queries #6619

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions snuba/admin/clickhouse/system_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ def is_query_using_only_system_tables(

for line in explain_query_tree_result.results:
line = line[0].strip()
# We don't allow table functions for now as the clickhouse analyzer isn't good enough yet to resolve those tables
if line.startswith("TABLE_FUNCTION"):
# We don't allow table functions (except clusterAllReplicas) for now as the clickhouse analyzer isn't good enough yet to resolve those tables
if (
line.startswith("TABLE_FUNCTION")
and "table_function_name: clusterAllReplicas" not in line
):
return False
if line.startswith("TABLE"):
match = re.search(r"table_name:\s*(\S+)", line, re.IGNORECASE)
Expand Down
1 change: 1 addition & 0 deletions tests/admin/test_system_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
ORDER BY
memory DESC
""",
"SELECT hostname(), avg(query_duration_ms) FROM clusterAllReplicas('default', system.query_log) GROUP BY hostname()",
],
)
@pytest.mark.clickhouse_db
Expand Down
Loading