dbt™ development
Last updated
Last updated
DinoAI enhances your dbt™ development by providing inline code assistance and automating key tasks. At the heart of DinoAI's dbt™ development features is the Copilot - your dedicated AI assistant within the Code IDE.
DinoAI's Copilot provides instant, context-aware support for virtually any inquiry related to your dbt™ development workflow. Whether you need help optimizing model performance, guidance on handling data transformations, or suggestions for implementing incremental models, Copilot is here to help without disrupting your focus.
You can ask Copilot questions such as:
"How can I optimize the performance of my dbt models?"
"What's the best way to handle data quality issues in my dbt project?"
"Can you suggest a pattern for implementing incremental models in dbt?"
Copilot will provide you with tailored responses, allowing you to stay productive and avoid the need to context switch.
You can further tailor the Copilot's behavior and responses by defining custom instructions in the .dinorules file. This allows you to specify your team's coding patterns, best practices, and other project-specific guidelines.
In addition to answering freeform questions, DinoAI's Copilot also provides a set of one-click commands that you can use to perform specific dbt™-related tasks:
Command Name | Command syntax | Tutorial |
---|---|---|
| ||
| ||
| ||
| ||
| ||
| ||
|
You can access these commands by either clicking the Dino AI icon (🪄) on the left side panel of the Code IDE, or right-clicking a .sql file in your project.
DinoAI simplifies the process of creating dbt models by generating code based on your prompts. The code generated is tailored to your project's structure and context.
Open DinoAI: Click the Dino AI icon (🪄) on the left side of the Code IDE.
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:
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.
Use the Data Explorer to ensure the fixes work as expected
For additional guidance, see video tutorial.
DinoAI provides detailed explanations of your dbt™ models, breaking down their purpose, structure, and key components.
Right-Click a .sql File: Right-click on a .sql file in the project directory, files tab, or one that's currently open in the IDE.
Select "Explain Model": In the DinoAI Copilot dropdown, click "Explain model".
Review Explanation: Read the AI-generated summary of your model's purpose, output, and explanations.
Alternative method:
Open DinoAI: Click the DinoAI 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
directly in the prompt.
Specify Your Model: Enter the name of the model you want explained. For example: /explain @stg_customers
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.
Right-Click a .sql File: Right-click on a .sql file in the project directory, files tab, or one that's currently open in the IDE.
Select "Fix Model": In the DinoAI Copilot dropdown, click "Fix model".
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.
Use the Data Explorer to ensure the fixes work as expected
Alternative method:
Open DinoAI: Click the DinoAI icon (🪄) on the left side of the Editor.
Access the "Fix Model" Feature: Select the "One Click" command "Find issues and fix a dbt model", or type /fix
directly in the prompt.
Specify Your Model: Enter the name of the model you want explained. For example: /fix @stg_customers
DinoAI can automatically generate comprehensive tests tailored to the structure and content of your dbt™ models, helping you maintain data integrity and consistency across your projects. You can use DinoAI to generate standard dbt™ tests or Elementary-specific tests, depending on your testing framework.
Right-Click a .sql File: Right-click on a .sql file in the project directory, files tab, or one that's currently open in the IDE.
Select "Generate tests": In the DinoAI Copilot dropdown, click "Generate tests".
Implement Test: Copy the generated test code and paste it into the appropriate .yml file in your project (e.g., schema.yml
)
Refine as Needed: Edit and update the test as required for your specific use case.
Execute dbt test
in the terminal to ensure it works as expected.
Alternative method:
Open DinoAI: Click the DinoAI icon (🪄) on the left side of the Editor.
Access the "Test model" Feature: Select the "One Click" command "Generate tests for a dbt model", or type /test
directly in the prompt.
Specify Your Model: Enter the name of the model you want to generate a test for. For example: /test @stg_customers
DinoAI can generate entity relationship diagrams (ERDs) using Mermaid.js, allowing you to easily understand and communicate the relationships between different entities in your data.
How to use:
Right-Click a .sql File: Right-click on a .sql file in the project directory, files tab, or one that's currently open in the IDE.
Select "Generate Mermaid Diagram": In the DinoAI Copilot dropdown, click "Generate Mermaid Diagram".
Review Generated Code: Carefully examine the AI-generated Mermaid code.
Implement the ERD: Copy the generated code and paste it into a new .mmd
file in your project, for example, stg_customers.mmd
.
Visualize: Open the Paradime editor and upload the .mmd
file. Click on the eye icon (👀) in the top right corner to view the rendered diagram.
Alternative method to access the Mermaid Diagram feature:
Open DinoAI: Click the Dino AI icon (🪄) on the left side of the Editor.
Access the Mermaid Model Feature: Select the "One Click" command "Generate a mermaid diagram for a dbt model", or type "/mermaid" + the model name into in the prompt (e.g. /mermaid @stg_customers
)
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.
Right-click a .sql file: Right-click a .sql file that contains raw SQL (without dbt™ syntax) from the project folder, the files tabs, or within an opened .sql file.
Hover over the DinoAI Copilot dropdown and select the 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.
Use the Data Explorer to ensure the fixes work as expected.