Skip to main content
The fastest way to get started is using our dbt template repository, which includes pre-configured profiles, sample models, and CI/CD workflows.

Prerequisites

  • Dune Enterprise account with Data Transformations enabled
  • Dune API key (generate one here)
  • Team name on Dune (defines your namespace)
  • dbt installed locally (we recommend using uv for dependency management)

1. Use the Template Repository

We provide a complete dbt project template to get started quickly: GitHub Template: github.com/duneanalytics/dune-dbt-template The template includes:
  • Pre-configured dbt profiles for dev and prod environments
  • Sample models demonstrating all model types
  • GitHub Actions workflows for CI/CD
  • Cursor AI rules for dbt best practices on Dune
  • Example project structure following dbt conventions
CI Workflows Are Disabled by DefaultThe template repository ships with GitHub Actions CI workflows disabled by default. Since each dbt execution consumes Dune credits, we recommend:
  1. Running models locally first to get familiar with your pipeline
  2. Reviewing the Pricing & Best Practices guide
  3. Enabling workflows when you’re ready by uncommenting triggers in the workflow files (see the template README for instructions)
To use the template:

2. Configure Environment Variables

Set these required environment variables:
Persistence options:

3. Configure dbt Profile

Your profiles.yml should look like this:
The transformations: true session property is required. This tells Dune that you’re running data transformation operations that need write access.

4. Test Your Connection

Project Structure

The template repository follows standard dbt conventions:

Schema Organization

Schemas are automatically organized based on your dbt target: This is controlled by the get_custom_schema.sql macro in the template.

How It Works

Namespace Isolation

All tables and views you create are organized into your team’s namespace:
  • Production schema: {your_team} - For production tables
  • Development schemas: {your_team}__tmp_* - For development and testing
This ensures complete isolation between teams and between development/production environments.

Write Operations

Execute SQL statements to create and manage your data:
  1. Create tables and views in your namespace
  2. Insert, update, or merge data using standard SQL
  3. Drop tables when no longer needed
  4. Optimize and vacuum tables for optimal performance when querying these tables
All operations are authenticated via your Dune API key and restricted to your team’s namespace.

Data Access

What You Can Read:
  • All public Dune datasets: Full access to blockchain data across all supported chains
  • Your uploaded data: Private datasets you’ve uploaded to Dune
  • Your transformation outputs: Tables and views created in your namespace
  • Materialized views: Views that are materialized as tables in your namespace via the APP
What You Can Write:
  • Your team namespace: {team_name} for production tables
  • Development namespaces: {team_name}__tmp_* for dev and testing
  • Private by default: All created tables are private unless explicitly made public
Access Control:
  • Write operations are restricted to your team’s namespaces only
  • Cannot write to public schemas or other teams’ namespaces
  • Schema naming rules enforced: no __tmp_ in team handles

Querying dbt Models on Dune

When querying your dbt models in the Dune app or via the API, you must use the dune. catalog prefix.
Pattern: dune.{schema}.{table}
dbt logs omit the catalog name for readability, so remember to add dune. when using queries in the Dune app.

Where Your Data Appears

Tables and views created through dbt appear in the Data Explorer under: My Data → Connectors Data Transformations in Data Explorer under Connectors You can:
  • Browse your transformation datasets
  • View table schemas and metadata
  • Delete datasets directly from the UI
  • Search and reference them in queries

Next Steps

Incremental Models

Learn about merge, delete+insert, and append strategies

CI/CD & Workflows

Set up GitHub Actions and development workflows