0
0
dbtdata~10 mins

Version pinning and updates in dbt - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Version pinning and updates
Start: Define dbt project
Specify dbt version in packages.yml
Run dbt commands
dbt uses pinned version
Check for updates
Update version
Run dbt with new version
End
This flow shows how you set a specific dbt version, run commands using that version, check for updates, and optionally update the version.
Execution Sample
dbt
packages:
  - package: dbt-labs/dbt_utils
    version: 0.8.0

# Run dbt deps to install pinned versions
This code pins the dbt_utils package to version 0.8.0 and installs it.
Execution Table
StepActionVersion SpecifiedCommand RunResult
1Read packages.ymldbt_utils 0.8.0N/AVersion pinned for dbt_utils
2Run 'dbt deps'dbt_utils 0.8.0dbt depsInstalls dbt_utils 0.8.0
3Run 'dbt run'dbt_utils 0.8.0dbt runRuns models using pinned version
4Check for newer versiondbt_utils 0.8.0Check onlineNewer version 0.9.0 available
5Decide to updatedbt_utils 0.8.0Update packages.yml to 0.9.0Version updated to 0.9.0
6Run 'dbt deps' againdbt_utils 0.9.0dbt depsInstalls dbt_utils 0.9.0
7Run 'dbt run' againdbt_utils 0.9.0dbt runRuns models using updated version
8Enddbt_utils 0.9.0N/AProcess complete
💡 Process ends after running dbt with updated version or continuing with pinned version.
Variable Tracker
VariableStartAfter Step 2After Step 5After Step 6Final
dbt_utils_versionNot set0.8.00.9.00.9.00.9.0
dbt_commandNonedbt depsNonedbt depsdbt run
Key Moments - 2 Insights
Why does dbt use the version specified in packages.yml instead of the latest?
dbt uses the pinned version to ensure consistent behavior and avoid unexpected errors from newer versions, as shown in step 2 and 3 where version 0.8.0 is used.
What happens if you update the version in packages.yml but forget to run 'dbt deps'?
The old version remains installed and used because 'dbt deps' installs the specified versions. This is why step 6 reruns 'dbt deps' after updating the version.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what version of dbt_utils is installed after step 2?
A0.9.0
BNot installed
C0.8.0
DLatest available
💡 Hint
Check the 'Version Specified' and 'Result' columns at step 2.
At which step does the dbt_utils version get updated to 0.9.0?
AStep 5
BStep 3
CStep 7
DStep 2
💡 Hint
Look for the step where 'Update packages.yml to 0.9.0' happens.
If you skip running 'dbt deps' after updating the version, what will happen when you run 'dbt run'?
AIt will use the new version anyway
BIt will use the old version still installed
CIt will fail to run
DIt will prompt to install dependencies
💡 Hint
Refer to the key moment about forgetting to run 'dbt deps' after update.
Concept Snapshot
Version pinning in dbt means specifying exact package versions in packages.yml.
Run 'dbt deps' to install these versions.
This ensures consistent runs and avoids surprises.
To update, change version in packages.yml and rerun 'dbt deps'.
Always run 'dbt deps' after changing versions.
Full Transcript
In dbt, version pinning means you fix the version of packages you use by writing it in packages.yml. When you run 'dbt deps', dbt installs exactly those versions. This keeps your project stable and predictable. If a new version is available, you can update the version number in packages.yml and run 'dbt deps' again to install the new version. Without running 'dbt deps', dbt will keep using the old version. This process helps you control when and how you update your tools.