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:
- Open DinoAI: Click the Dino AI icon (🪄) on the left side of the Editor.
- Access the Create Model Feature: Select the “One Click” command “Create a dbt model”, or type “/model” in the prompt.
- 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.
- Review Generated Code: Carefully examine the AI-generated model code.
- Implement the Model: Copy the generated code and paste it into the appropriate .sql file in your project.
- 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:
- Open DinoAI: Click the Dino AI icon (🪄) on the left side of the Editor.
- Access the Explain Model Feature: Select the “One Click” command “Explain a dbt model”, or type “/explain” in the prompt.
- Specify Your Model: Enter the name of the model you want explained. For example:
/Explain nba_player_info
- 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:
- Right-click a .sql file in the project folder, files tab, or open file.
- 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:
- Open DinoAI: Click the Dino AI icon (🪄) on the left side of the Editor.
- Access the Debug Feature: Select the “One Click” command “Debug a dbt model”, or type “/fix” in the prompt.
- Specify Your Model: Enter the name of the model you want to debug. For example:
/Fix @nba_player_info
- Review Changes: Carefully examine the summary of changes made and the full, debugged code.
- Implement Fixes: Copy the debugged code and paste it into your project’s appropriate .sql file.
- Verify: Use the Data Explorer to ensure the fixes work as expected.
Alternative method to access the Copilot’s ‘/Explain’ command:
- Right-click a .sql file in the project folder, files tab, or open file.
- 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:
- 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.
- Hover over the DinoAI Copilot dropdown and select option “Convert SQL to dbt model”
- Review Generated Code: Carefully examine the AI-generated model code.
- Implement the Model: Copy the generated code and paste it into the appropriate .sql file in your project.
- Refine as Needed: Modify the generated code to meet your specific requirements and project standards.
- Verify: Use the Data Explorer to ensure the model output is as expected.
Alternative method to access the Copilot’s ‘/sql_to_dbt’ command:
- Right-click a .sql file in the project folder, files tab, or open file.
- In the DinoAI Copilot dropdown, select “Convert SQL to dbt model”.