Example usage
Examples
By adding a MCP Server to our extension - developers can use a quick iteration workflow with AI Agents to create, document, test, and fix dbt models quickly. All the examples below follow this workflow:
- Write to the AI Prompt
- Review the AI Agents steps, thought process, and changes
- Accept or Refuse those changes
- Iterate
In all the examples we're running a Jaffleshop + duckdb + dbt core setup.
Docs and Tests Generation
In this example we used this prompt "Can you create tests on customer models and validate them." Next we follow on with "Can you create tests on customer models and validate them" The AI Agent calls several MCP tools:
- get_columns_of_models
- execute_sql_with_limit
- install_dbt_packages
- run_model_test
- install_dependencies
The AI Agent updated the docs after each logic change. Just like every engineer does :)
dbt Models Creation - Customer Lifetime Value (CLTV)
In this example we used this prompt "I want to create a new model which calculates customer lifetime value" The AI Agent calls several MCP tools:
- get_projects
- run_model
- execute_sql_with_limit
We also followed up with asking for additonal metrics to add to the model.
Fixing dbt Lineage
In this example we fast followed the last example (CLTV model creation) with fixing the data lineage. We noticed the CLTV model was pointing directly to staging models. We used this prompt to address this "Can you create a patments model on top of the stg_payments? After that Let's make sure our customer lifetime value model doesn't point directly to staging models. It should point to ordesr, customers, and payments." The AI Agent calls several MCP tools:
- get_projects
- get_columns_of_models
- run_model
We ended by looking at the lineage to ensure we no longer referenced staging models directly.
Fixing dbt Model Fanout
In this example we fast followed the last example (Fixing lineae) with searching the project for dbt model fan out. First we prompted the AI agent with this: "Can you find models that are fanning out to more than 2 models?
The AI Agent calls several MCP tools:
- get_projects
- get_children_models
We then prompted with: "Create some intermediate models to fix the fan out" The AI Agent created a plan for us and created intermediate models. We can follow on here later to address naming models and organizing your dbt project as well.