Accelerating dbt™ Development

DinoAI enhances your dbt™ development by automating tasks such as model creation, explanation, debugging, and SQL-to-dbt™ conversion. This guide will help you leverage DinoAI to speed up your dbt™ development process, ensuring your models are well-structured, accurate, and aligned with your project standards.

Estimated completion time: 15 minutes

Prerequisites

  • Basic understanding of dbt™ concepts and SQL


What you'll learn

In this guide, you'll learn how to use DinoAI for:


1. Creating dbt™ Models

Creating dbt™ models is a foundational step in any dbt™ project. DinoAI simplifies this process by generating model code based on your prompts, ensuring consistency and saving time across your project.

How to use:

  1. Open DinoAI: Click the Dino AI icon (🪄) on the left side of the Editor.

  2. Access the Create Model Feature: Select the "One Click" command "Create a dbt model", or type "/model" in the prompt.

  3. Describe Your Model: Enter a detailed prompt for the dbt model you'd like to create. For example:

/model Create a dbt model named int_nba_player_info that joins all columns from nba_player_info with the salary and season columns from nba_player_salaries, using the player_id column as the join key. Materialize it as a view.

  1. Review Generated Code: Carefully examine the AI-generated model code.

  2. Implement the Model: Copy the generated code and paste it into the appropriate .sql file in your project.

  3. Refine as Needed: Modify the generated code to meet your specific requirements and project standards.


2. Explaining dbt™ Models

Understanding complex dbt™ models is essential for maintaining and collaborating on your data projects. DinoAI provides detailed explanations of your dbt™ models, breaking down their purpose, structure, and key components.

How to get started:

  1. Open DinoAI: Click the Dino AI icon (🪄) on the left side of the Editor.

  2. Access the Explain Model Feature: Select the "One Click" command "Explain a dbt model", or type "/explain" in the prompt.

  3. Specify Your Model: Enter the name of the model you want explained. For example:

/Explain nba_player_info

  1. Review Explanation: Carefully read the AI-generated summary of your model's purpose, output, and explanations of key parts like CTEs and subqueries.

Alternative method to access the Copilot's '/Explain' command:

  1. Right-click a .sql file in the project folder, files tab, or open file.

  2. In the DinoAI Copilot dropdown, select "Explain model".


3. Debugging dbt™ Models

Ensuring that your dbt™ models are free of errors is critical for the reliability of your data pipeline. DinoAI assists in debugging by identifying issues in your models and providing fixes.

How to use:

  1. Open DinoAI: Click the Dino AI icon (🪄) on the left side of the Editor.

  2. Access the Debug Feature: Select the "One Click" command "Debug a dbt model", or type "/fix" in the prompt.

  3. Specify Your Model: Enter the name of the model you want to debug. For example:

/Fix @nba_player_info

  1. Review Changes: Carefully examine the summary of changes made and the full, debugged code.

  2. Implement Fixes: Copy the debugged code and paste it into your project's appropriate .sql file.

  3. Verify: Use the Data Explorer to ensure the fixes work as expected.

Alternative method to access the Copilot's '/Explain' command:

  1. Right-click a .sql file in the project folder, files tab, or open file.

  2. In the DinoAI Copilot dropdown, select "Fix model".


4. Converting SQL to dbt™ Models

Converting existing SQL queries into dbt™ models can save significant development time. DinoAI automates this conversion process, allowing you to quickly transition from raw queries to structured dbt™ models.

How to use:

  1. Right-click a .sql file: You can right click a .sql file from the project folder, the files tabs, or within an opened .sql file.

  2. Hover over the DinoAI Copilot dropdown and select option "Convert SQL to dbt model"

  3. Review Generated Code: Carefully examine the AI-generated model code.

  4. Implement the Model: Copy the generated code and paste it into the appropriate .sql file in your project.

  5. Refine as Needed: Modify the generated code to meet your specific requirements and project standards.

  6. Verify: Use the Data Explorer to ensure the model output is as expected.

Alternative method to access the Copilot's '/sql_to_dbt' command:

  1. Right-click a .sql file in the project folder, files tab, or open file.

  2. In the DinoAI Copilot dropdown, select "Convert SQL to dbt model".


Summary

You've learned how to use DinoAI to accelerate your dbt™ development through model creation, explanation, debugging, and SQL conversion. These features speed up your workflow, enhance code quality, and improve collaboration, allowing you to focus more on data strategy.

Next, we'll learn about some advanced Developer features in the Code IDE to further improve your dbt™ development process.

Last updated