mirror of https://github.com/apache/superset.git
fix(sql_parse): Support Jinja format() filter when extracting latest[_sub]_partition (#28117)
This commit is contained in:
parent
7263c7cb47
commit
2f11f66167
|
@ -1559,7 +1559,7 @@ def extract_tables_from_jinja_sql(sql: str, database: Database) -> set[Table]:
|
|||
Table(
|
||||
*[
|
||||
remove_quotes(part.strip())
|
||||
for part in node.args[0].value.split(".")[::-1]
|
||||
for part in node.args[0].as_const().split(".")[::-1]
|
||||
if len(node.args) == 1
|
||||
]
|
||||
)
|
||||
|
|
|
@ -1942,6 +1942,7 @@ def test_sqlstatement() -> None:
|
|||
[
|
||||
"latest_partition('foo.bar')",
|
||||
"latest_partition(' foo.bar ')", # Non-atypical user error which works
|
||||
"latest_partition('foo.%s'|format('bar'))",
|
||||
"latest_sub_partition('foo.bar', baz='qux')",
|
||||
],
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue