{"id":11330,"date":"2026-07-16T15:11:45","date_gmt":"2026-07-16T15:11:45","guid":{"rendered":"https:\/\/i-spark.nl\/?p=11330"},"modified":"2026-07-16T15:12:44","modified_gmt":"2026-07-16T15:12:44","slug":"how-to-connect-claude-code-to-dbt","status":"publish","type":"post","link":"https:\/\/i-spark.nl\/en\/blog\/how-to-connect-claude-code-to-dbt\/","title":{"rendered":"How to connect Claude Code to dbt and what a proper set-up looks like"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">If you work with dbt, you know the parts that slow you down. Writing the YAML, adding the tests and keeping the documentation in sync with what the model actually does. The parts that don&#8217;t require much thinking but take a significant amount of time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Claude Code, working directly inside your Power BI project via VSCode and GitHub, handles much of the overhead. Once it&#8217;s properly set up with your PBIP files, anyone on the team can describe what they need in plain language and get a working first draft back, DAX that references your tables, relationships, and model.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This article covers what the connection enables, where it works best, and what it involves.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How the connection between Claude Code and dbt works<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Claude Code works directly inside your dbt project in VSCode. It reads your models, sources, tests, and documentation from the repository before generating anything. When you ask it to create a new staging model, it knows which sources already exist. When you ask it to add tests, it knows what columns are available and what tests are already in place. Everything generated goes through a pull request, the same review process you already use.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Taking it further: MCP integration<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For those who want to go one step further, a Model Context Protocol (MCP) connection is a natural next step. MCP gives Claude Code live access to the running dbt environment. In this way, Claude can query metadata that isn&#8217;t stored in files, such as lineage information, run history, and real-time project state. The setup requires an MCP server configuration and slightly more infrastructure overhead, but meaningfully expands what Claude can access<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>i-spark can set this up as a follow-on engagement after the initial sprint.<\/em><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What can you do with Claude Code connected to dbt<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"819\" height=\"1024\" src=\"https:\/\/i-spark.nl\/wp-content\/uploads\/2026\/07\/image-10-819x1024.png\" alt=\"\" class=\"wp-image-11332\" srcset=\"https:\/\/i-spark.nl\/wp-content\/uploads\/2026\/07\/image-10-819x1024.png 819w, https:\/\/i-spark.nl\/wp-content\/uploads\/2026\/07\/image-10-240x300.png 240w, https:\/\/i-spark.nl\/wp-content\/uploads\/2026\/07\/image-10-768x960.png 768w, https:\/\/i-spark.nl\/wp-content\/uploads\/2026\/07\/image-10.png 1080w\" sizes=\"(max-width: 819px) 100vw, 819px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Building new models. <\/strong>Creating a staging model for a new source used to mean writing the SQL, adding the YAML, writing the tests, and documenting: four separate steps, each requiring dbt-specific knowledge. With Claude Code connected, you describe the source and what you need from it, and get a working draft of all four. Getting to something reviewable goes from an hour to a few minutes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Refactoring existing SQL. <\/strong>dbt projects can accumulate models that were written quickly and never cleaned up. Claude Code can read an existing model and restructure it into clean, modular dbt, splitting out CTEs properly, applying naming conventions, and flagging logic that could be pushed into a ref. The original logic stays intact; the code becomes maintainable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Debugging failing runs. <\/strong>When a dbt run fails, the error message tells you where, not necessarily why. With Claude Code connected to your project, you can describe the error in plain language and get a diagnosis that accounts for your actual model structure.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Documentation catch-up. <\/strong>Undocumented dbt models are one of the most common pain points we hear about. Nobody has time to write descriptions when they&#8217;re building, and it never gets done retrospectively. Claude Code can work through existing models systematically. Doing it manually across a large project takes days. From our experience with Claude Code, it takes hours.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Answering questions about the project. <\/strong>You can ask questions about your data model in plain language: which models depend on this source, what tests exist on this column, and where this metric is calculated. For anyone new to the project, or anyone who hasn&#8217;t looked at a particular part of the codebase in a while, this alone saves significant time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Where it works best and where to be careful<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The connection is most useful on projects that have some structure already. If your models follow consistent naming conventions, your sources are declared, and your project has documentation in place, Claude Code can work with all of that context and produce output that fits naturally into what exists.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On messier projects, the output is still technically valid, but it&#8217;s harder to verify and more likely to contain subtle errors. The setup is a good moment to address that debt, not because it&#8217;s required, but because the return on the connection is meaningfully higher when the project is clean.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The other thing to be clear about: Claude Code generates drafts. Generated models should go through the same pull request process as anything else. If you skip review because the output looks plausible, you will eventually merge something incorrect, such as wrong numbers in dashboards that take weeks to trace back.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to make Claude Code work in your team<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The most common failure mode we see with Claude Code and dbt is that someone gets it working locally, shows their team an impressive demo, and then the setup lives on their machine.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Getting it working for a team rather than an individual is a configuration question. The MCP server configuration should live in the project repository alongside everything else. dbt Core and dbt Cloud have slightly different connection patterns, and the configuration needs to match your version.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Beyond that, you should agree upfront on what Claude Code is and isn&#8217;t expected to do. Generating draft models is different from committing directly. Being explicit about that boundary early is a lot simpler than trying to unpick it after someone has pushed AI-generated code straight to main.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Getting started with Claude Code and dbt<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The setup itself isn&#8217;t complex. You need access to your dbt project, a working Claude Code installation, and an MCP server configuration that matches your dbt version.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The part that takes more care is making it production-ready: tested against your actual models, documented so the next person who joins knows how to use it, and configured for how your team actually works.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><em>i-spark runs a one-day setup sprint for teams who want Claude Code properly connected to their dbt environment, configured for your project, tested against your models, and handed over with a walkthrough.<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>If you work with dbt, you know the parts that slow you down. Writing the YAML, adding the tests and keeping the documentation in sync with what the model actually does. The parts that don&#8217;t require much thinking but take a significant amount of time. Claude Code, working directly inside your Power BI project via [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":11331,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[433,8,438],"tags":[],"class_list":["post-11330","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-machine-learning","category-blog","category-practical-guides"],"acf":[],"_links":{"self":[{"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/posts\/11330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/comments?post=11330"}],"version-history":[{"count":1,"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/posts\/11330\/revisions"}],"predecessor-version":[{"id":11333,"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/posts\/11330\/revisions\/11333"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/media\/11331"}],"wp:attachment":[{"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/media?parent=11330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/categories?post=11330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i-spark.nl\/en\/wp-json\/wp\/v2\/tags?post=11330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}