dbtzend-db-table

DBT encounters an error "'dbt_utils' is undefined"


Hello could anyone help me how to check this error message I'm encountering. previously it used to work but upon running dbt clean its not working anymore. Your response is highly appreciated. Thank you so much.

Steps to recreate:

dbt clean; dbt deps; dbt test

my packages.yml contains this one

packages:
  - package: dbt-labs/dbt_utils
    version: 1.0.0

packages:
  - package: calogica/dbt_expectations
    version: [">=0.8.0", "<0.9.0"]

Screenshot:

schema.yml screenshot

schema.yml structure

dbt deps installation

Error message


Solution

  • You've duplicated the packages: key, and dbt is ignoring the first one. Your packages.yml file should look like this, with only one packages: key:

    packages:
      - package: dbt-labs/dbt_utils
        version: 1.0.0
      - package: calogica/dbt_expectations
        version: [">=0.8.0", "<0.9.0"]
    

    This probably used to be okay because dbt_expectations used to depend on dbt_utils (via dbt_date), but it doesn't anymore (since dbt_date doesn't), so when you ran dbt clean && dbt deps, it grabbed a newer version of dbt_expectations, which didn't also install dbt_utils.