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

[Feature] Fail during dbt parse when any dependency is not installed via dbt deps #10760

Open
2 tasks done
davidharting opened this issue Sep 23, 2024 · 6 comments
Open
2 tasks done

Comments

@davidharting
Copy link

davidharting commented Sep 23, 2024

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

dbt parse succeeds when a package specified in packages.yml is not installed

Expected Behavior

dbt parse should fail and instruct me to run dbt deps

Steps To Reproduce

You can watch along with the reproduction in this Zoom clip.

  1. Clone https://github.com/dbt-labs/jaffle_shop_duckdb and follow instructions to install dependencies and activate virtual environment
  2. Run dbt parse. Notice that it succeeds.
  3. Create a packages.yml. Make it look like this:
packages:
  - package: dbt-labs/codegen
    version: ["<1.0.0"]
  1. Run dbt deps
  2. Update packages.yml to add another package:
packages:
  - package: dbt-labs/codegen
    version: ["<1.0.0"]
  - package: fivetran/salesforce 
    version: [">=1.1.0", "<1.2.0"]
  1. Run dbt parse (Do not run dbt deps first)
  2. Notice that dbt parse succeeds 🐛 when it should actually fail due to missing fivetran/salesforce

Relevant log output

No response

Environment

- OS: MacOS 14.16.1
- Python: 3.12.5
- dbt: 1.8.1

Which database adapter are you using with dbt?

other (mention it in "Additional Context")

Additional Context

dbt-duckdb 1.8.1

Looks like Feature Request #4557 would be one way of resolving this bug?

@davidharting davidharting added bug Something isn't working triage Impact: Exp labels Sep 23, 2024
@davidharting
Copy link
Author

davidharting commented Sep 23, 2024

I added the Impact: Exp label to this.

The Cloud IDE has a feature that automatically runs deps for users when needed. However, this feature depends on parse failing with the error message about missing dependencies. When parse comes back clean but a dependency is missing, this feature no does not work.

@gshank
Copy link
Contributor

gshank commented Sep 23, 2024

I don't believe that this is a bug. Parsing processes the project files. If none of them reference a project that's been added to dependencies, then there is no error. This is a feature request. It seems like a reasonable feature request from Cloud's perspective, but what you're asking for is that "parsing" do a kind of mini-deps command.

@davidharting
Copy link
Author

davidharting commented Sep 23, 2024

@gshank I see what you are saying, but I there is an inconsistency in behavior that lead me to file this as a bug.

In some circumstances, dbt parse does fail with a Compilation Error when missing packages:

$ dbt parse
14:43:53  Running with dbt=1.8.1
14:43:53  Registered adapter: duckdb=1.8.1
14:43:53  Encountered an error:
Compilation Error
  dbt found 2 package(s) specified in packages.yml, but only 0 package(s) installed in dbt_packages. Run "dbt deps" to install package dependencies.

but what you're asking for is that "parsing" do a kind of mini-deps command.

I'm not sure exactly what you mean by a "mini-deps command."

Because of the compilation error I pasted above, I am not expecting parse to install dependencies for me. But I am expecting it to detect when I am missing installed dependencies. Basically, I'm saying that that CompilationError has set that expectation, which is then not always upheld. Thus my take that this is a bug.

@gshank
Copy link
Contributor

gshank commented Sep 23, 2024

The code does a count of packages in packages.yml and compares that against the count of dependencies, which is where that error comes from. The problem is that there is no easy connection between the packages specified in packages.yml and the "dependencies" that are loaded. The actual name of the package comes from the dbt_project.yml file, not from the "name" of the package that's specified. We could store more information about the loaded dependencies for a better comparison, which is probably a good idea, but it's not "fixable" with what we have currently.

@dbeatty10
Copy link
Contributor

Per @gshank's feedback, I'm going to recategorize this as a feature request (we can always switch it back to a bug report if that seems appropriate).

@dbeatty10 dbeatty10 added enhancement New feature or request and removed bug Something isn't working labels Sep 23, 2024
@dbeatty10 dbeatty10 changed the title [Bug] Parse incorrectly succeeds when dependency is not installed [Feature] Fail during dbt parse when any dependency is not installed via dbt deps Sep 23, 2024
@ChenyuLInx
Copy link
Contributor

An update to this should be a be behind behavior flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants