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
Defining vars, folder-level configs outside dbt_project.yml #2955
Comments
Some additional thoughts/failure modes/concerns to think about with this:
One thought that comes to me - what if we had another separate set of subdirectories that were specifically dedicated to .yml files for config, like we already have a subdirectory declaration/space for snapshots, models, etc. Only things related to/extracted from dbt_project.yml could be put in there, and any other things related to models, snapshots, etc., would trigger a parsing error. This doesn't fix problem 1 above but it at least helps with problem 2. What say ye? P.S. Also, I know var namespacing was removed for dbt_project.yml v2 config in .17 for some good reasons but it's also pretty hard not to have any way to do variable scoping in larger projects. |
@codigo-ergo-sum I don't think I've ever seen you post from this alt account before. It goes without saying that I like the handle.
This is along the lines of what I was thinking: either an explicit set of subdirectories, or an explicit set of named files. I've been around just long enough to remember when I'd be especially keen on a Configurations feel a bit trickier, because these can be especially verbose. How to coordinate hierarchies across multiple files without someone tripping over someone else? I'm honestly not sure. The cleanest separation I can envision would be allowing a project to have one each of
This is fair. I wonder if the ability to scope |
Thanks for the compliment on the username @jtcohen6 :). I think a Would it be required or could vars also still be defined in If not required, then what would the behavior look like if vars are defined in both places, and if they conflict? And are you suggesting that |
I absolutely support the idea of parsing the vars before the dbt_project.yml. |
Having outside vars available in We have a complex For example: source-paths:
- modules/shared/models
- modules/module1/models
- modules/module2/models
- stages/{{ env_var('DBT_STAGE', '@fake@') }}/models Then enabling a particular stage via env var during deployment. Would be great to set the stage once in the vars file, and then just use the var itself in the config. Also be able to define module names / prefixes, or even an entire array of modules to loop over. |
Hello 👋 In our company, we are using a lot DBT in a multi tenant context. For that purpose, we rely a lot on DBT variables with which we propagate the client configuration. Those configurations could be really different from a client to another. We did not find a proper workaround for now. Passing a file path instead of a payload for our variables would probably solve our issue. This is why we are keen to know if there is any chance you are going to consider such feature for DBT ? (cc. @jtcohen6) Thank you in advance 🙏 |
++ this feature. The solution implemented by Jekyll (with _data directory) comes to mind as suitable. |
Hi all, I agree that a vars.yml will be a good boost, but there you'll have just some global variables. Based on my background experience I think you should think as well to a solution for local variables. Some sort of accepting in a model configuration to define a model_vars.yml and use the variables for that specific model from there. Thank you. |
I agree. Hope this will get implemented soon as it is always a good practice to modularize the configurations, rather than having everything in same single file. |
dbt still only allow global variables defined in dbt_projetc.yml? |
Just looking through issue backlogs and wanted to bump this... Would be great as we are working with projects that have tens or even hundreds of variables now. Also the lack of ability to namespace them is still challenging. |
I'm also facing this problem and would very much love some ideas of how to tackle it! |
Currently we're trying to workaround this issue by using environment variables (and tooling via direnv and a .envrc file) |
Sneaky workaround whilst wait for this to be built into core. Basically move var declarations into macro files: https://gist.github.com/jeremyyeo/06d552ee8facc8100416655ebc25d9b9 |
This is exactly what we started to POC in our DBT stack. Using a dedicated macro file to load bigger JSON payload.
And then you can use it in your model:
That's a workaround that should make the job. |
Folder-level configs would make a huge difference on my project. With 50+ developers and growing we don't want anyone to modify project-level files day-to-day, but we do want them to manage many files and folders in their subject area. Folder-level configs would do this. Clearly the need is there which is why they are featured in dbt_project.yml but this causes governance and git conflict problems where many teams trying to make changes to project-level files at the same time. Basically, I need to treat our subject areas as mini-projects, each mini-project having its own configuration. |
Within #8869, @slotrans described If this feature request were added, then it would solve that use-case. |
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. |
Describe the feature
From @benjaminsingleton:
Describe alternatives you've considered
dbt_project.yml
gets really really big??Additional context
Who will this benefit?
The text was updated successfully, but these errors were encountered: