-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Use static analyzer to extract unrendered_config
from config()
#3680
Comments
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest; add a comment to notify the maintainers. |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers. |
The ideas in #2714 set the course for a lot of the static analysis we've pursued in the time since. We've managed to do some of the things enumerated there, with the biggest coups being:
depends_on.macros
for macrosWe pursued many of those things for performance reasons, though there are spinoff benefits for
state:modified
as well. One enticing possibility: extracting and storing theunrendered_configs
based on the arguments within a Jinjaconfig()
macro. For instance:Today, dbt can only store the rendered version of that config,
'table'
or'view'
, captured duringrender_update
. If a user switches targets betweendev
andprod
, dbt will detect that as a modification (a false positive).Imagine instead: Our tree-sitter grammar and extractor could return
'table' if target.name == 'prod' else 'dev'
asnode.unrendered_config.materialized
, then pass that expression in for Jinja rendering, and store the rendered value asnode.config.materialized.
When it comes time to compare modifications, we can compare the unmodified, unrendered Jinja expressions.I think this will be a much more fruitful endeavor than trying to parse the Jinja AST, which we found unpleasant in our work on
dispatch
backwards compatibility. At a conceptual level, however, the guidance from #2714 still apply:The text was updated successfully, but these errors were encountered: