-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sql_parse): Provide more lenient logic when extracting latest[_sub]_partition #28152
fix(sql_parse): Provide more lenient logic when extracting latest[_sub]_partition #28152
Conversation
{Table(table="bar", schema="foo")}, | ||
), | ||
( | ||
"SELECT * FROM foo.baz WHERE quux = '{{{{ {engine}.{macro} }}}}'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example no longer exists. It's a trivial extension from the previous logic, but was making the nested parametrization challenging.
] | ||
# Try to extract the table referenced in the macro. | ||
try: | ||
tables.add( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same logic as before, just nested within a try/except block.
SUMMARY
This is a follow up to #28117, which sadly wasn't suffice when variables as opposed to constants were being used with the
format()
Jinja macro.Sadly the
as_const()
method has only been implemented for a subset of node types and given that the plethora of logic which one could define is vast it's likely best to just acknowledge there are times when we wont be able to accurately extract the table referenced by thelatest[_sub]_partition
Jinja macro.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Added unit tests.
ADDITIONAL INFORMATION