dbt-core icon indicating copy to clipboard operation
dbt-core copied to clipboard

[Bug] dbt deps automatically recognizes projects in subdirectories

Open djbelknapaw opened this issue 1 year ago • 6 comments

Is this a new bug in dbt-core?

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

Current Behavior

I'm attempting to build an integration_tests sub-project similar to dbt_utils, then install the parent project when running the integration tests. The file in my_project/integration_tests/packages.yml file is the same as in dbt_utils:

packages:
    - local: ../

This installs the parent project as a package, but that includes the integration_tests child project which dbt is recognizing as a project, and attempts to install its dependencies again, resulting in an endless call of dependencies.

I end up with a directory structure of:

my_project
/integration_tests
/integration_tests/dbt_packages/my_project
/integration_tests/dbt_packages/my_project/integration_tests
/integration_tests/dbt_packages/my_project/integration_tests/dbt_packages/my_project
...

Eventually deps fails with an error: "[WinError 206] The filename or extension is too long: 'dbt_packages\\\\my_project\\\\integration_tests\\\\dbt_packages\\\\my_project\\\\integration_tests\\\\dbt_packages\\\\my_project\\\\integration_tests\\\\dbt_packages\\\\my_project\\\\integration_tests\\\\dbt_packages\\\\my_project\\\\integration_tests'"

Expected Behavior

When running dbt deps to a local project, only recognize the project.yml and packages.yml from the directly-referenced project and not sub-project directories. In this example, dbt should only look at ../packages.yml and not be looking at ../integration_tests/packages.yml.

Steps To Reproduce

  1. Create a project containing a sub-project
  2. In the sub-project, add a package pointing to the parent project
  3. Run dbt deps

Relevant log output

No response

Environment

- OS: Windows 10
- Python: 3.11.7
- dbt: 1.7.9

Which database adapter are you using with dbt?

No response

Additional Context

No response

djbelknapaw avatar Mar 01 '24 18:03 djbelknapaw