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 (#27842)

(cherry picked from commit 5ab95aa)
  • Loading branch information
john-bodley authored and michael-s-molina committed Apr 8, 2024
1 parent 54942e2 commit a39971a
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 @@ -1093,7 +1093,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 @@ -1890,6 +1890,7 @@ def test_is_select() -> 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 a39971a

Please sign in to comment.