mirror of
https://github.com/apache/superset.git
synced 2026-04-17 07:05:04 +00:00
fix: improve function detection (#33306)
This commit is contained in:
@@ -1237,6 +1237,35 @@ def test_check_sql_functions_exist() -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_check_sql_functions_exist_with_comments() -> None:
|
||||
"""
|
||||
Test sql functions are detected correctly with comments
|
||||
"""
|
||||
assert not (
|
||||
check_sql_functions_exist(
|
||||
"select a, b from version/**/", {"version"}, "postgresql"
|
||||
)
|
||||
)
|
||||
|
||||
assert check_sql_functions_exist("select version/**/()", {"version"}, "postgresql")
|
||||
|
||||
assert check_sql_functions_exist(
|
||||
"select version from version/**/()", {"version"}, "postgresql"
|
||||
)
|
||||
|
||||
assert check_sql_functions_exist(
|
||||
"select 1, a.version from (select version from version/**/()) as a",
|
||||
{"version"},
|
||||
"postgresql",
|
||||
)
|
||||
|
||||
assert check_sql_functions_exist(
|
||||
"select 1, a.version from (select version/**/()) as a",
|
||||
{"version"},
|
||||
"postgresql",
|
||||
)
|
||||
|
||||
|
||||
def test_sanitize_clause_valid():
|
||||
# regular clauses
|
||||
assert sanitize_clause("col = 1") == "col = 1"
|
||||
|
||||
Reference in New Issue
Block a user