-
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
[Regression] Unable to access environment variables #10422
Comments
Thanks for reaching out @DanMawdsleyBA ! Are you sure that the I tried this in both 1.7 and 1.8, and I got the same error when it was not defined:
But things worked as expected for me in both 1.8 and 1.7 when it was defined. |
``Yes all of my environment variables were setup before and working in dbt 1.7 . I have setup a new venv running with dbt 1.7 which does work so it only seems to only be introduced when I switch to 1.8. Logs of 1.7:
I'm wondering if the OS or something else is different in your testing. I'm currently running on Windows . Logs of command on 1.7: Same command on 1.8: |
I'm using the For clarity, you can see the see the value of the environment variable in both your v1.7 and v1.8 environments when you print out the value using one of the following methods? I'm wondering if Using Command Prompt (cmd): echo %local_user% Using PowerShell: echo $env:local_user |
@DanMawdsleyBA I'm not sure what's going on here. We did make an update within Could you try running each of the following Python scripts to see if each recognizes your Show just one environment variable: import os
var = "local_user"
print("\nSpecific variable:\n")
if var in os.environ:
print(f"Environment variable '{var}': {os.environ[var]}")
else:
print(f"Environment variable '{var}' not found") Show all environment variables: import os
print("\nAll environment variables:\n")
for key, value in os.environ.items():
print(f"{key}: {value}") |
@DanMawdsleyBA Could it be something to do with the casing? |
@DanMawdsleyBA glad that we discovered a workaround by changing the variable name to uppercase. We're wondering if something about the caching implementation of #9489 lost Windows' case-insensitivity of environment variable names and that explains the difference between v1.7 and v1.8. In terms of testing, @aranke is going to try something like the following: Windows:
Unix-like:export local_user=dan
|
I am experiencing the same issue and having to roll back all projects to 1.7. Confirmed with echo $env:x that the variables are loaded into the environment. Is there any path forward or workaround for this? |
Is this a new bug in dbt-core?
Current Behavior
Environment variables are no longer working. I was using dbt-core 1.7.3 previously where I use environment varaibles for my profiles.yml file. Since upgrading to 1.8.3 dbt is no longer able to access these same environement variables.
I have my environement varaibles setup in vscode under the settings json file example below:
Expected Behavior
Expect DBT to be able to read my environement variables like in the previous version of dbt 1.7 .
Steps To Reproduce
Upgrade to dbt core 1.8 .
Use environment variables as part of dbt. In the profiles file example below:
Relevant log output
dbt parse 10:16:51 Running with dbt=1.8.3 10:16:51 Encountered an error: Parsing Error Env var required but not provided: 'local_user'
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
No response
The text was updated successfully, but these errors were encountered: