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

[CT-2785] [Feature] support .env file #8026

Closed
1 of 3 tasks
RobbertDM opened this issue Jul 4, 2023 · 4 comments
Closed
1 of 3 tasks

[CT-2785] [Feature] support .env file #8026

RobbertDM opened this issue Jul 4, 2023 · 4 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@RobbertDM
Copy link
Contributor

RobbertDM commented Jul 4, 2023

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

It would be cool if you could just drop a .env file in the directory next to dbt_project.yml and profiles.yml so you can do dbt run --env_file=./.env or even specify env_file: .env in your profiles.yml.

Describe alternatives you've considered

I think many people are now doing set -a; source .env; set +a before dbt run.

Who will this benefit?

Anyone who has their environment variables specified in a .env file.
Typically, that would contain db hostname and credentials, e.g. POSTGRES_USER=my_postgres_user.

Are you interested in contributing this feature?

No response

Anything else?

No response

@RobbertDM RobbertDM added enhancement New feature or request triage labels Jul 4, 2023
@github-actions github-actions bot changed the title [Feature] support .env file [CT-2785] [Feature] support .env file Jul 4, 2023
@jtcohen6
Copy link
Contributor

jtcohen6 commented Jul 4, 2023

@RobbertDM I agree!

What do you think of the dbt.env file that I'm proposing in this related issue?

@RobbertDM
Copy link
Contributor Author

Looks good, for us it's mostly about not checking credentials into git but still being able to share the profiles.yml across team members, so atm we work with the above set -a; source .env; set +a. Your proposal would get rid of that, so I'm happy with it :)

We also use the same .env file to set environment variables for other software (custom python scripts), but we can always just ln -s .env dbt.env.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Jul 7, 2023

Right on — I'm going to close this one in favor of #6207

@jtcohen6 jtcohen6 closed this as completed Jul 7, 2023
@jtcohen6 jtcohen6 removed their assignment Jul 7, 2023
@jtcohen6 jtcohen6 added duplicate This issue or pull request already exists and removed triage labels Jul 7, 2023
@jtcohen6 jtcohen6 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 7, 2023
@sdebruyn
Copy link
Contributor

Since the linked tickets have been closed and this has been kicked out of scope there, might be good to reopen this issue. Basically all we want is that dbt reads a .env file and that I can access those vars using env_var() in jinja.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants