0
0
dbtdata~10 mins

Installing packages with packages.yml in dbt - Visual Walkthrough

Choose your learning style9 modes available
Concept Flow - Installing packages with packages.yml
Create packages.yml file
Add package details
Run 'dbt deps' command
dbt downloads packages
Packages installed in 'dbt_packages'
Use packages in your project
This flow shows how to add package info to packages.yml, run dbt deps to download, and then use the packages.
Execution Sample
dbt
packages:
  - package: fishtown-analytics/dbt_utils
    version: 0.8.6
This packages.yml file tells dbt to install the dbt_utils package version 0.8.6.
Execution Table
StepActionCommand/ContentResult
1Create packages.ymlAdd package name and versionFile created with package info
2Run dbt depsdbt depsdbt reads packages.yml
3Download packagesdbt downloads dbt_utils v0.8.6Package saved in dbt_packages
4Verify installationCheck dbt_packages folderdbt_utils package present
5Use packageReference dbt_utils in modelsPackage functions available
6ExitNo more packages to installProcess complete
💡 All packages listed in packages.yml are installed and ready to use.
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
packages.yml contentemptypackage: fishtown-analytics/dbt_utils v0.8.6read by dbt depspackage downloadedpackage ready in dbt_packages
dbt_packages folderemptyemptyemptydbt_utils v0.8.6 presentdbt_utils usable
Key Moments - 2 Insights
Why do we need to run 'dbt deps' after creating packages.yml?
Because dbt reads packages.yml only when you run 'dbt deps' to download and install the packages, as shown in steps 2 and 3 of the execution_table.
What happens if the version number in packages.yml is missing or incorrect?
dbt may download the latest version or fail to find the package. The execution_table step 3 shows the importance of specifying the correct version.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the result after running 'dbt deps'?
Adbt reads packages.yml
BPackage functions become available
CFile packages.yml is created
Ddbt_packages folder is deleted
💡 Hint
Check Step 2 in the execution_table where 'dbt deps' is run.
At which step does the package get downloaded into dbt_packages?
AStep 1
BStep 5
CStep 3
DStep 6
💡 Hint
Look at Step 3 in the execution_table for the download action.
If you forget to run 'dbt deps', what will happen when you try to use the package?
Adbt will automatically download the package
BThe package will not be found and cause errors
CThe package functions will work normally
DThe packages.yml file will be deleted
💡 Hint
Refer to the key_moments about running 'dbt deps' and the execution_table steps.
Concept Snapshot
packages.yml lists packages with name and version
Run 'dbt deps' to download packages
Packages saved in dbt_packages folder
Use package functions in your dbt models
Always specify correct version
Run 'dbt deps' after editing packages.yml
Full Transcript
To install packages in dbt, you create a packages.yml file listing the packages and their versions. Then you run the command 'dbt deps' which reads this file and downloads the packages into the dbt_packages folder. After this, you can use the package functions in your dbt project. If you do not run 'dbt deps', the packages will not be downloaded and your project will not find them. Specifying the correct version in packages.yml ensures you get the right package version.