mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore(deps): Upgrade sqlglot from 27.15.2 to 28.10.0 (#37841)
This commit is contained in:
committed by
GitHub
parent
ae8d671fea
commit
c41942a38a
@@ -1867,6 +1867,23 @@ def test_as_cte(sql: str, engine: str, expected: str) -> None:
|
||||
assert SQLStatement(sql, engine).as_cte().format() == expected
|
||||
|
||||
|
||||
def test_as_cte_called_twice() -> None:
|
||||
"""
|
||||
Test that calling as_cte() multiple times on the same instance works.
|
||||
|
||||
Regression test for a bug where as_cte() sets self._parsed.args["with_"] = None
|
||||
after extracting CTEs, but has_cte() only checked if the key existed, not if
|
||||
the value was truthy. This caused an AttributeError on subsequent as_cte() calls.
|
||||
"""
|
||||
sql = "WITH cte AS (SELECT 1) SELECT * FROM cte"
|
||||
stmt = SQLStatement(sql, "postgresql")
|
||||
|
||||
assert stmt.has_cte() is True
|
||||
stmt.as_cte()
|
||||
assert stmt.has_cte() is False
|
||||
stmt.as_cte()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"sql, rules, expected",
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user