Skip to content

Commit

Permalink
chore(sql_parse): Strip leading/trailing whitespace in Jinja macro ex…
Browse files Browse the repository at this point in the history
…traction (apache#27842)
  • Loading branch information
john-bodley authored and EnxDev committed Apr 12, 2024
1 parent 229bdcc commit 9adb054
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion superset/sql_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ def extract_tables_from_jinja_sql(sql: str, database: Database) -> set[Table]:
tables.add(
Table(
*[
remove_quotes(part)
remove_quotes(part.strip())
for part in node.args[0].value.split(".")[::-1]
if len(node.args) == 1
]
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/sql_parse_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,7 @@ def test_sqlstatement() -> None:
"macro",
[
"latest_partition('foo.bar')",
"latest_partition(' foo.bar ')", # Non-atypical user error which works
"latest_sub_partition('foo.bar', baz='qux')",
],
)
Expand Down

0 comments on commit 9adb054

Please sign in to comment.