fix: is_select with UNION (#25290)

This commit is contained in:
Beto Dealmeida
2023-09-14 09:05:19 -07:00
committed by GitHub
parent e1ddba9c0f
commit bb002d6147
2 changed files with 17 additions and 3 deletions

View File

@@ -1623,3 +1623,13 @@ def test_is_select() -> None:
Test `is_select`.
"""
assert not ParsedQuery("SELECT 1; DROP DATABASE superset").is_select()
assert ParsedQuery(
"with base as(select id from table1 union all select id from table2) select * from base"
).is_select()
assert ParsedQuery(
"""
WITH t AS (
SELECT 1 UNION ALL SELECT 2
)
SELECT * FROM t"""
).is_select()