mirror of
https://github.com/apache/superset.git
synced 2026-04-12 12:47:53 +00:00
fix: is_select check for lowercase select with "WITH" clauses (#22370)
This commit is contained in:
committed by
GitHub
parent
37a78b14be
commit
e9b4022787
@@ -1008,6 +1008,28 @@ FROM foo f"""
|
||||
assert sql.is_select()
|
||||
|
||||
|
||||
def test_cte_is_select_lowercase() -> None:
|
||||
"""
|
||||
Some CTEs with lowercase select are not correctly identified as SELECTS.
|
||||
"""
|
||||
sql = ParsedQuery(
|
||||
"""WITH foo AS(
|
||||
select
|
||||
FLOOR(__time TO WEEK) AS "week",
|
||||
name,
|
||||
COUNT(DISTINCT user_id) AS "unique_users"
|
||||
FROM "druid"."my_table"
|
||||
GROUP BY 1,2
|
||||
)
|
||||
select
|
||||
f.week,
|
||||
f.name,
|
||||
f.unique_users
|
||||
FROM foo f"""
|
||||
)
|
||||
assert sql.is_select()
|
||||
|
||||
|
||||
def test_unknown_select() -> None:
|
||||
"""
|
||||
Test that `is_select` works when sqlparse fails to identify the type.
|
||||
|
||||
Reference in New Issue
Block a user