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.

Optional: You can add context by selecting your sources.yml file or existing models. Context allows DinoAI to understand your naming conventions and maintain consistency with your existing files.


Step-by-Step Instructions

  1. Open DinoAI by clicking the DinoAI icon (🪄) in the left panel

  2. Select Agent Mode if it's not already selected

  3. Optional: Add context 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

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

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

  2. Test the model using dbt™ commands or Data Explorer for flexibility


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

Last updated

Was this helpful?