Skip to content
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

[implementation] define project-wide vars in vars.yml, outside of dbt_project.yml #11144

Open
graciegoheen opened this issue Dec 12, 2024 · 2 comments
Labels
help_wanted Trickier changes, with a clear starting point, good for previous/experienced contributors paper_cut A small change that impacts lots of users in their day-to-day user docs [docs.getdbt.com] Needs better documentation yaml

Comments

@graciegoheen
Copy link
Contributor

graciegoheen commented Dec 12, 2024

Short description

From #2955

"I want to define project-wide variables outside of my dbt_project.yml."
"I want to be able to reference variables in my dbt_project.yml at parse-time."

Acceptance criteria

  • I can define project-wide ("global variables") variables in a vars.yml file, separate from my dbt_project.yml
# vars.yml

vars:
  start_date: '2016-06-01'
  • dbt parses vars.yml before parsing dbt_project.yml, meaning default values of vars called in dbt_project.yml would work the way folks expect, rather than how it is today (equivalent to how this works when defining vars through the CLI a la --vars)

Option 1 - behavior change

  • You cannot define variables in both places, you must chose the "new" or "legacy" way
  • As such, this would need to be behind a behavior change flag
  • Open question: Given that behavior change flags are set in dbt_project.yml, would this even be possible?

Option 2 - backwards compatible

  • You can define variables in either places
  • Open question: Would we still get the parsing benefit if we went this route?

Current workaround: Have a really massive dbt_project.yml file with no ability to reference variables in your project configurations

@graciegoheen graciegoheen added user docs [docs.getdbt.com] Needs better documentation yaml paper_cut A small change that impacts lots of users in their day-to-day help_wanted Trickier changes, with a clear starting point, good for previous/experienced contributors labels Dec 12, 2024
@b-per
Copy link
Contributor

b-per commented Dec 13, 2024

Is there a reason to make it specific for vars instead of making it possible for any configuration like in this other issue?

@graciegoheen
Copy link
Contributor Author

graciegoheen commented Dec 13, 2024

@b-per Doing this specifically for vars gives us this added benefit - "I want to be able to reference variables in my dbt_project.yml at parse-time" - because we can then parse the vars.yml before dbt_project.yml

That being said, I don't think this is an either/or - we could do YAML snippets as well :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help_wanted Trickier changes, with a clear starting point, good for previous/experienced contributors paper_cut A small change that impacts lots of users in their day-to-day user docs [docs.getdbt.com] Needs better documentation yaml
Projects
None yet
Development

No branches or pull requests

2 participants