chore(sql_parse): Strip leading/trailing whitespace in Jinja macro extraction (#27842)

(cherry picked from commit 5ab95aaf7d)
This commit is contained in:
John Bodley 2024-04-02 17:08:42 -07:00 committed by Michael S. Molina
parent 54942e2eaa
commit a39971abcd
2 changed files with 2 additions and 1 deletions

View File

@ -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
]

View File

@ -1890,6 +1890,7 @@ SELECT * FROM t"""
"macro",
[
"latest_partition('foo.bar')",
"latest_partition(' foo.bar ')", # Non-atypical user error which works
"latest_sub_partition('foo.bar', baz='qux')",
],
)