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-25] [Bug] dbt deps should not require a profile #4554

Closed
1 task done
olivierdet opened this issue Jan 6, 2022 · 4 comments · Fixed by #4610 or #4651
Closed
1 task done

[CT-25] [Bug] dbt deps should not require a profile #4554

olivierdet opened this issue Jan 6, 2022 · 4 comments · Fixed by #4610 or #4651
Assignees
Labels
bug Something isn't working deps dbt's package manager regression
Milestone

Comments

@olivierdet
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

We have defined a profile like that :

    prod:
      type: redshift
      threads: "{{ env_var('DBT_THREADS', 1)| int }}"
      host: "{{ env_var('REDSHIFT_HOST') }}"
      port: 5439
      user: "{{ env_var('REDSHIFT_USER') }}"
      pass: "{{ env_var('REDSHIFT_PASSWORD') }}"
      dbname: "{{ env_var('REDSHIFT_DATABASE') }}"
      schema: "bi"

If one of the env is not defined ( ex : REDSHIFT_DATABASE) we now have the following error message while running dbt deps

13:26:05  Encountered an error:
Parsing Error
  Env var required but not provided: 'REDSHIFT_DATABASE'

If it is defined with a dummy data, it works properly. ( So it does not check connection)

Expected Behavior

dbt depsshould not return any issue when a env variable is not defined.

Steps To Reproduce

  1. Define a profile with env variable
  2. Do not define the given env variable
  3. run dbt deps

Relevant log output

No response

Environment

- OS:container python:3.9.6-slim-buster
- Python: 3.9.6
- dbt:1.0.0

What database are you using dbt with?

redshift

Additional Context

No response

@olivierdet olivierdet added bug Something isn't working triage labels Jan 6, 2022
@github-actions github-actions bot changed the title [Bug] dbt deps [CT-25] [Bug] dbt deps Jan 6, 2022
@gshank
Copy link
Contributor

gshank commented Jan 10, 2022

When you say "we now have the following error message", do you mean that this used to work? In what version? A quick glance at the code shows that throwing an error for a missing env_var is not new to 1.0.0.

I think the ability to set a default for the env_var, like you do for DBT_THREADS, is designed for this case. You could do env_var('REDSHIFT_DATABASE, '').

@olivierdet
Copy link
Author

olivierdet commented Jan 11, 2022

Hello, it was working perfectly for the version before the 1.0.0.
We are using this logic for in the version 0.21.1 (and before also)
This bug is seen when we try to move to version 1.0.0

@gshank gshank removed the triage label Jan 17, 2022
@gshank gshank self-assigned this Jan 17, 2022
@gshank
Copy link
Contributor

gshank commented Jan 17, 2022

This bug is due to changing the env_var exception to a parsing exception, so that the exception is not caught in _get_rendered_profile in core/dbt/config/runtime.py. The error that is issued in 0.21 is not correct however, and this is not a good way to handle suppressing profile errors because the final error reported is not correct.

This should be fixed, however, since we should not need to load a profile for the dbt deps command.

@gshank gshank added this to the v1.0.2 milestone Jan 17, 2022
@jtcohen6 jtcohen6 added the packages Functionality for interacting with installed packages label Jan 17, 2022
@leahwicz
Copy link
Contributor

We should also check dbt clean and dbt debug

@leahwicz leahwicz changed the title [CT-25] [Bug] dbt deps [CT-25] [Bug] dbt deps should not require a profile Jan 19, 2022
@gshank gshank self-assigned this Jan 21, 2022
@jtcohen6 jtcohen6 added deps dbt's package manager and removed packages Functionality for interacting with installed packages labels Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working deps dbt's package manager regression
Projects
None yet
4 participants