> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paradime.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 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

<Info>
  **Prerequisites**

  * [Paradime developer or admin permissions](/products/settings/users/roles-and-permissions)
  * [A dbt™ project set up in Paradime](/guides/paradime-101/getting-started-with-the-paradime-ide/setting-up-a-dbt-project)
  * Basic understanding of SQL and dbt™ concepts
  * Basic understanding of Git and version control concepts
</Info>

### What you'll learn:

* [Create a new file for your model](/guides/paradime-101/getting-started-with-the-paradime-ide/creating-a-dbt-model#id-2.-create-a-new-file)
* [Write a dbt™ model](/guides/paradime-101/getting-started-with-the-paradime-ide/creating-a-dbt-model#id-3.-write-a-dbt-tm-model)
* [Materialize your model](/guides/paradime-101/getting-started-with-the-paradime-ide/creating-a-dbt-model#id-5.-materialize-your-dbt-tm-model)

***

### 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:

1. **Open Git Lite:** Click the source control icon within the left panel of the IDE.
2. **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

<iframe src="https://www.youtube.com/embed/dMFjx85PK04" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />

Create a new .sql file for your dbt™ model:

1. **Open your project file:** Click the folder Icon (📁) in the left panel to view your dbt™ project files.
2. **Create a new file:** Right-click on the folder where you want to add your new file (e.g., `models/sources`) and click `New File`.
3. **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**

<iframe src="https://www.youtube.com/embed/6Uvt7BCMMyg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />

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:

```sql theme={"system"}
WITH source AS (
    SELECT 
        person_id AS player_id,
        first_name,
        last_name,
        team_name,
        position,
        height,
        weight
    FROM 
        {{ source('PUBLIC', 'COMMON_PLAYER_INFO') }}
    )
    
    SELECT 
        *
    FROM
        source
```

### 4. Materialize Your dbt™ Model

With your model written and previewed, it's time to materialize it in the data warehouse:

1. **Execute dbt run:** In the terminal at the bottom of your screen, run the command `dbt run`.
2. **Check for errors:** Review any errors or warnings that appear during the build process and resolve them as needed.

<Info>
  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
</Info>

### 5. Commit and Push

After successfully building your model, commit and push your work using the learnings from the [previous tutorial](/guides/paradime-101/getting-started-with-the-paradime-ide/setting-up-a-dbt-project#id-4.-version-control).

1. **Write your commit message:** Use DinoAI's "Write Commit" feature to automatically generate a detailed commit message tailored to your specific code changes.
2. **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.
3. **Open a Pull Request (PR):** Create a PR to allow your team to review and discuss the updates before merging.

***

<Info>
  **Related Documentation**

  * [Using Paradime's integrated terminal (CLI)](/products/code-ide/terminal/index)
  * [Running dbt™ in Paradime's integrated terminal (CLI)](/products/code-ide/terminal/running-dbt)
</Info>

***

### 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](/guides/paradime-101/getting-started-with-the-paradime-ide/data-exploration-in-the-code-ide).


## Related topics

- [Accelerating dbt™ Development](/guides/paradime-101/getting-started-with-the-paradime-ide/dinoai-accelerating-your-analytics-engineering-workflow/accelerating-dbt-development.md)
- [Models and Transformations](/guides/dbt-fundamentals/getting-started-with-dbt/models-and-transformations.md)
- [Run and Test all your dbt™ Models](/products/bolt/creating-schedules/templates/dbt-tm-templates/run-and-test-all-your-dbt-tm-models.md)
- [dbt™ Model Query Cost Optimizer — Snowflake](/guides/programmable-agents/dbt-tm-model-query-cost-optimizer-snowflake.md)
- [dbt™ Model Query Cost Optimizer — BigQuery](/guides/programmable-agents/dbt-tm-model-query-cost-optimizer-bigquery.md)
