What Does dbt compile Do?
Last updated July 25, 2026 · By the SaturnSQL team
dbt compile renders the Jinja in your models into plain SQL without executing anything against the warehouse. The compiled files land in target/compiled/, which is the fastest way to see what ref(), sources, and macros actually expand to.
dbt compile --select fct_orders
cat target/compiled/my_project/models/marts/fct_orders.sqlWhen to use it
Use compile to debug Jinja, review the SQL a macro generates, or copy runnable SQL into a query editor. Note that target/run/ holds the same SQL wrapped in the materialization DDL (CREATE TABLE AS ...), which is what dbt run actually executes. Compiling does require a working connection, since dbt needs the adapter to resolve some context.
Run this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it free