-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 some issues around global-scoped vars #2477
Conversation
Fix global-level var rewriting from v2 -> v1 Add top-level vars to more lookup fields When a user calls var() in a `generate_*_name` macro, on failure it now raises (like at runtime) When a node has no FQN, pretend the FQN is just the package name when returning vars Add tests
Change variables named `l` to `log` Make IsFQNResource runtime type-checkable and use that to handle the FQN check Make the GenerateNameProvider its own top-level Provider type
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.
One question, but otherwise this LGTM
|
||
project_type_vars.update({ | ||
k: v for k, v in src_vars.items() | ||
if not isinstance(v, dict) |
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.
what's the thinking here? Is it that we don't want to provide package-scoped vars to the wrong package? It also means that you can't provide a global var that is a dict to a v1 package, right?
I'm curious what the ramifications would be if we removed this filter and added all of the src_vars to the v1 package's vars
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.
Yeah. We can remove that if not isinstance
, I thought it made the debug dictionary really a pain.
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.
ok, that's fine - let's ship it as-is and I'll be sure to update the docs accordingly
resolves #2469
resolves #2473
resolves #2472
Description
Fix global-level var rewriting from v2 -> v1
+
syntax in the future.Add top-level vars to more lookup fields
vars
, and a couple only handled the package-scoped ones. I believe I've resolved all of them.When a user calls var() in a
generate_*_name
macro, on failure it now raises (like at runtime)var
andconfig
act as if it were runtime. Maybeconfig.get
just should not work at all?When a node has no FQN, pretend the FQN is just the package name when returning vars
generate_*_name
macros would somehow resolve vars against thenode
they're passed instead of the context's node. That's a much more complicated problem that probably deserves its own issue/PR process!Checklist
CHANGELOG.md
and added information about my change to the "dbt next" section.