-
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
Allow declaration of vars in schema.yml #2377
Comments
hey @DVAlexHiggs - cool idea! Unfortunately, I don't think this is something we're going to add support for. If you check out #2312 , you can see that we very recently made a ton of changes around variable scoping. Historically, variables were scoped at the folder-level. This meant that you could do something like:
In this setup, a model in To resolve inconsistencies like this, we've added a
Note though that variables can still be scoped to packages:
I just wanted to give some background on how we're thinking about variables, and some of the recent changes that impact variable usage. Given these changes, I don't think we'll be able to add model-scoped variables like you've described here. I do however think your use case is a good one, and I can imagine two paths forward:
This would look like:
We could then provide a way to tap into these configuration values in the model .sql file context, eg:
See #1790 for more info Curious to hear what you think about these changes and options |
Hey @drewbanin thanks for your response. I think both of these solutions have their merits. Solution 1 is more dbt-esque and provides more functionality to the current I think solution 2 is a powerful alternative with a lot of versatility, but perhaps more care than usual would need to be taken with directory structures and organisation of the YAML files. |
HI, any news on this? Really excited if this is being considered. I'm happy to contribute it myself as well, though I would need a point in the right direction to start with. Perhaps we could talk about this? |
Ok - thanks for the additional context for this one on Slack @DVAlexHiggs. To recap: You're leveraging the datavault package which relies on I really like the idea of allowing model configs in .yml files. We have a dedicated issue for this over here: #2401. I think #2401 was inspired by this very issue :) #2401 outlines a very similar syntax to what you described above, except the key will be
We'll need to think about the order of parsing. I think a sensible order of operations is:
If we make the configs from the |
@drewbanin I think the order you've specified makes sense. This will be a huge help for uber-templated models |
Yes the order makes sense, and I agree that |
Closing in favor of #2401 |
Describe the feature
It would be excellent if it were possible to provide vars to models in schema.yml files like so:
Additional context
I'm suggesting this feature because the
dbt_project.yml
file gets considerably large and hard to manage at scale, when needing to provide variables to multiple models. It would be a lot easier to manage if there were a way to split the variables into sub-files, and I thought theschema.yml
files would be a perfect candidate, as they already exist and are designed to hold other information related to models.Who will this benefit?
This would mainly benefit larger companies who have created libraries of macros/packages with arguments whose values differ between models, and would prefer not to fill their model files with the setting of variables, but find it too difficult to manage if it's all in the
dbt_project.yml
The text was updated successfully, but these errors were encountered: