# Generating dbt™ models

Analytics engineers need to create models with readable column names, consistent naming conventions, and appropriate transformations. This repetitive process can be tedious, especially with tables containing many columns or complex relationships.

DinoAI Agent can automatically generate well-structured models that transform raw source data into more user-friendly formats.

### Example Prompt

> *Create an intermediate model that joins customer data from the 'stg\_customers' model with order information from 'stg\_orders', and calculate lifetime value metrics.*

{% hint style="info" %}
**Optional**: You can add [context](/app-help/documentation/dino-ai/context.md) by selecting your sources.yml file or existing models. Context allows DinoAI to understand your naming conventions and maintain consistency with your existing files.
{% endhint %}

<figure><img src="/files/zV2z54maCXF2ckQbC37R" alt=""><figcaption></figcaption></figure>

***

### Step-by-Step Instructions

1. **Open DinoAI** by clicking the DinoAI icon (🪄) in the right panel
2. **Select Agent Mode** if it's not already selected
3. **Optional*****:*** [**Add context**](/app-help/documentation/dino-ai/context.md) by clicking the "@" symbol and selecting:
   1. Existing similar models to follow their pattern
   2. The models you want to reference
   3. Directory structure to understand project organization
4. **Enter your prompt** describing the model you want to create

{% hint style="info" %}
**Be specific** about:

1. The type of model (base, intermediate, mart)

2. Tables to join or reference

3. Any calculations or transformations needed

4. Materialization type if relevant
   {% endhint %}

5. **Review/Accept the changes** to create the file in your project

6. **Test the model** using dbt™ commands or [Data Explorer](/app-help/documentation/code-ide/command-panel/data-explorer.md) for flexibility

{% @arcade/embed url="<https://app.arcade.software/share/lpSe6lLsmULpQH7qrqYw>" flowId="lpSe6lLsmULpQH7qrqYw" %}

***

### How It Works

After you enter your prompt:

1. DinoAI analyzes your sources.yml file and any provided context
2. It creates appropriate folder structure for the model
3. It generates a model with properly structured CTEs and join conditions
4. If configured, DinoAI applies your [.dinorules](/app-help/documentation/dino-ai/dino-rules.md) preferences

***

### Key Benefits

* **Consistency**: Ensures all models follow the same patterns and conventions
* **Readability**: Makes column names more user-friendly and easier to understand
* **Efficiency**: Creates complex models in seconds rather than hours
* **Standards**: Applies your team's SQL formatting and naming conventions automatically


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.paradime.io/app-help/documentation/dino-ai/agent-mode/use-cases/generating-dbt-tm-models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
