-
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
[Feature] Add ability to import/include YAML from other files #9695
Comments
Thanks @b-per for opening this feature. We really need it to make dbt project be DRY. |
Hi team. Is it something that we'd be keen to merge if I write a PR for it? |
+1 for this feature |
I've been talking about this under the keywords "YAML inheritance" for at least a year. We desperately need it, IMO. I wouldn't be able to contribute to a PR, but I'm 100% on board for anything else to support it. |
|
As a few people have shown interest, I created a draft PR with the code I have so far. It is not ready to be merged, but some people might be willing to take it over from here. |
Is this your first time submitting a feature request?
Describe the feature
I wonder if dbt would benefit from providing the ability to include YAML snippets from other files.
Home Assistant (a popular python tool, leveraging YAML for config), provides a few additional YAML constructors (quick overview of constructors).
The most interesting one would be
!include
which allows to define values of keys in YAML from other YAML filesThe implementation of Home Assistant is in this source file.
While we can define some logic in Jinja in some YAML files, we are limited today to defining a single entry at a time (e.g. a string or a bool). With this approach we can also store config for nested fields.
Based on my first observations, this technique wouldn't mess with the current dbt code as the YAML is rendered before we start any "real" dbt parsing.
Describe alternatives you've considered
Copy pasting the same logic in YAML as we do today
Who will this benefit?
dbt_project.yml
from different files, with different code owners in gitAre you interested in contributing this feature?
Yes
Anything else?
I got an early prototype working locally and can share some of the code if we want to implement this feature.
The text was updated successfully, but these errors were encountered: