Recently I had the opportunity to work with packages closely and I published an article The Practical Guide to Utilizing DBT Packages for Data Transformation which explains dbt packages
and its underhood
Here is the quote:
To verify that a package is installed in your dbt project, you can check the packages.yml
file and run the dbt deps
command.
Check the packages.yml
file: This file lists all of the packages that are installed in your dbt project. Look for the name of the package you want to verify. If it is listed in the packages list, then it is installed.
Run the dbt deps
command:
- This command will show you a list of all of the packages that are installed in your dbt project. Look for the name of the package you want to verify. If it is listed, then it is installed.
- In the root dbt project dir, you observe a new dir
dbt_modules/
which contains the compiled packages that are ready to be used. NOTE: dir dbt_modules/
has to be added to .gitignore
.
>>> tree -L 1 .
.
├── data
├── dbt_modules
├── dbt_project.yml
├── macros
├── models
├── packages
├── packages.yml
├── profiles.yml
├── snapshots
└── target
If your packages.yml
file contains package that is not installed then you would not be able to run any dbt command:
>>> dbt list
Encountered an error:
Compilation Error
dbt found 1 package(s) specified in packages.yml, but only 0 package(s) installed in dbt_modules. Run dbt deps to install package dependencies.
So this is our guarantee that in runtime we would not have any issues related to the package installation.
dbt deps
as a first step. – Blatt