Creating a dbt™ Model
In this guide, you'll learn how to create your first dbt™ model in the Paradime IDE. By the end of this tutorial, you'll have a fully functional dbt™ model materialized in your data warehouse.
Estimated completion time: 10 minutes
Prerequisites
Basic understanding of SQL and dbt™ concepts
Basic understanding of Git and version control concepts
What you'll learn:
1. Create a New Branch
Before creating a model in your dbt™ project, it's essential to work on a new branch to keep your main branch clean and stable. Use Git Lite to create a new branch:
Open Git Lite: Click the source control icon within the left panel of the IDE.
Create a New Branch: Using the dropdown, select
+ New Branch
and give it a practical name (e.g.,my_first_dbt_model
).
2. Create a New File
Create a new .sql file for your dbt™ model:
Open your project file: Click the folder Icon (📁) in the left panel to view your dbt™ project files.
Create a new file: Right-click on the folder where you want to add your new file (e.g.,
models/sources
) and clickNew File
.Name your file: Use a descriptive name that reflects the purpose of the model (e.g.,
nba_player_info.sql
).
3. Write a dbt™ Model
With your new model open in the Code IDE, write SQL that transforms your data, using dbt's jinja syntax to reference sources and models dynamically. For example:
4. Materialize Your dbt™ Model
With your model written and previewed, it's time to materialize it in the data warehouse:
Execute dbt run: In the terminal at the bottom of your screen, run the command
dbt run
.Check for errors: Review any errors or warnings that appear during the build process and resolve them as needed.
You can also execute dbt commands from the commands panel. Click the "run model" dropdown and select your desired command for quick access to common dbt operations
5. Commit and Push
After successfully building your model, commit and push your work using the learnings from the previous tutorial.
Write your commit message: Use DinoAI's "Write Commit" feature to automatically generate a detailed commit message tailored to your specific code changes.
Commit and Push: Save your changes to your local repository, then push them to the remote repository to ensure your work is backed up and accessible.
Open a Pull Request (PR): Create a PR to allow your team to review and discuss the updates before merging.
Summary
Congratulations! You've successfully created your first dbt™ model in Paradime, from creating a new branch to committing your changes. Your model is now materialized in your data warehouse and ready for use.
Next, we'll explore how to use the code IDE for data exploration.
Last updated