Skip to content

Commit

Permalink
ref(admin): Allow merge function in FROM clause (#6643)
Browse files Browse the repository at this point in the history
This function creates a temporary merge table, which is very useful for
doing things like querying
across all the different settings tables.
  • Loading branch information
evanh authored Dec 10, 2024
1 parent 18b852d commit 3805250
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion snuba/admin/clickhouse/system_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +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 (except clusterAllReplicas) for now as the clickhouse analyzer isn't good enough yet to resolve those tables
# We don't allow table functions (except clusterAllReplicas/merge) 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
and "table_function_name: merge" not in line
):
return False
if line.startswith("TABLE"):
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 @@ -51,6 +51,7 @@
memory DESC
""",
"SELECT hostname(), avg(query_duration_ms) FROM clusterAllReplicas('default', system.query_log) GROUP BY hostname()",
"SELECT count() FROM merge('system', '.*settings')",
],
)
@pytest.mark.clickhouse_db
Expand Down

0 comments on commit 3805250

Please sign in to comment.