Skip to content

[CT-2854] [Feature] .dbtignore doesn't ignore files in dbt_packages #8169

@rlh1994

Description

@rlh1994

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

Adding reference to any files in the dbt_packages folder to the .dbtignore file does not lead to these being ignored. This may be needed as you wish to ignore certain files from the package (e.g. a sources or other yaml file that clashes, or docs. Models/seeds could be disabled via the project yaml).

Expected Behavior

These files would be ignored on a compile or a run.

Steps To Reproduce

  1. Initialise a new project
  2. Install a package that contains some models or seeds, e.g. :
    packages:
      - package: snowplow/snowplow_web
        version: [">=0.15.0"]
    
  3. Create and ddd the whole package folder to the .dbtignore file:
    dbt_packages/snowplow_web/*
    
  4. Run dbt run and notice that all models from the package is still included in the run.

Edit with a slightly easier example

  1. Install the dbt_utils package
    packages:
      - package: dbt-labs/dbt_utils
        version: 1.1.1
    
  2. Create and add the whole package folder to the .dbtignore file:
    dbt_packages
    
  3. Create a model that uses a dbt_utils macro, e.g. date_spine:
    {{ dbt_utils.date_spine(
        datepart="day",
        start_date="cast('2019-01-01' as date)",
        end_date="cast('2020-01-01' as date)"
       )
    }}
    
  4. Do a dbt run and this model passes, when it should fail (which you can verify by removing the package and doing a dbt clean, which should be the equivalent state if the package was being ignored).

End Edit

Relevant log output

No response

Environment

- OS: Mac OS
- Python: 3.9.13
- dbt:
Core:
  - installed: 1.5.1
  - latest:    1.5.3 - Update available!

  Your version of dbt-core is out of date!
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Plugins:
  - databricks: 1.5.4 - Update available!
  - bigquery:   1.5.1 - Update available!
  - snowflake:  1.5.1 - Update available!
  - redshift:   1.5.4 - Update available!
  - postgres:   1.5.1 - Update available!
  - spark:      1.5.0 - Up to date!

Which database adapter are you using with dbt?

Postgres

Additional Context

This PR introduced the feature, but I am not sure where in here these would be being not included in the ignore...
#5897

Metadata

Metadata

Assignees

No one assigned

    Labels

    RefinementMaintainer input neededenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions