0
0
dbtdata~10 mins

Creating your own dbt package - Visual Walkthrough

Choose your learning style9 modes available
Concept Flow - Creating your own dbt package
Start: Create package directory
Add dbt_project.yml file
Create models/ directory with SQL files
Define package dependencies (optional)
Run dbt commands: dbt deps, dbt build
Package ready to use or share
This flow shows the steps to create a dbt package: set up folder, add config, add models, manage dependencies, then build.
Execution Sample
dbt
mkdir my_dbt_package
cd my_dbt_package
# create dbt_project.yml
# add models/my_model.sql
# run dbt build
This code sets up a new dbt package folder, adds config and model, then builds the package.
Execution Table
StepActionFile/Folder CreatedCommand RunResult
1Create package foldermy_dbt_package/Folder created
2Add dbt_project.ymlmy_dbt_package/dbt_project.ymlProject config added
3Add models foldermy_dbt_package/models/Models folder created
4Add SQL model filemy_dbt_package/models/my_model.sqlModel SQL file added
5Install dependenciesdbt depsDependencies installed (if any)
6Build packagedbt buildModels compiled and run
7Package readyPackage can be used or shared
💡 All steps completed, package created and built successfully
Variable Tracker
VariableStartAfter Step 2After Step 4After Step 6Final
package_foldernonemy_dbt_package/my_dbt_package/my_dbt_package/my_dbt_package/
dbt_project.ymlnonecreatedcreatedcreatedcreated
models_foldernonenonecreatedcreatedcreated
model_sql_filenonenoneaddedaddedadded
dependenciesnonenonenoneinstalledinstalled
build_statusnonenonenonesuccesssuccess
Key Moments - 3 Insights
Why do we need the dbt_project.yml file?
The dbt_project.yml file tells dbt about your package settings and where to find models. Without it, dbt cannot build your package. See execution_table step 2.
What happens if you forget to add models/ folder?
Without the models folder and SQL files, dbt has nothing to build. The package will be empty. See execution_table step 3 and 4.
Why run 'dbt deps' before 'dbt build'?
'dbt deps' installs any package dependencies your package needs. Running it ensures all required packages are ready before building. See execution_table step 5.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is created at step 4?
Adbt_project.yml file
Bmodels folder
CSQL model file
Dpackage folder
💡 Hint
Check the 'File/Folder Created' column at step 4 in the execution_table
At which step does the package become ready to use?
AStep 6
BStep 7
CStep 5
DStep 4
💡 Hint
Look at the 'Result' column for the final step in the execution_table
If you skip 'dbt deps', what might happen?
ADependencies might be missing
BModels won't compile
CPackage folder won't be created
Ddbt_project.yml will be ignored
💡 Hint
Refer to the explanation in key_moments about step 5 in execution_table
Concept Snapshot
Creating your own dbt package:
1. Make a new folder for your package.
2. Add a dbt_project.yml file to configure it.
3. Create a models/ folder and add SQL files.
4. Run 'dbt deps' to install dependencies.
5. Run 'dbt build' to compile and run models.
6. Package is ready to use or share.
Full Transcript
To create your own dbt package, start by making a new folder. Inside, add a dbt_project.yml file which tells dbt about your package settings. Then create a models folder and add SQL model files there. If your package depends on others, run 'dbt deps' to install them. Finally, run 'dbt build' to compile and run your models. After these steps, your package is ready to use or share with others.