Building with dbt Inside Snowflake – A Guide to the Native Integration

Sriram KrishnanSriram Krishnan
4 min read

Over our last few chapters, we have laid the foundation of a modern data platform. We've explored the Lakehouse architecture, mastered the mechanics of Apache Iceberg, and learned to optimize performance and costs within Snowflake. We have a powerful engine and a reliable storage layer. Now, we need the framework to transform that raw data into trusted, production-grade data products.

For modern data teams, that framework is dbt (data build tool).

Until now, using dbt with Snowflake meant running it from an external environment, requiring you to manage credentials, network connections, and external compute. With the introduction of the native dbt Core integration in Snowflake (Preview), this paradigm has been fundamentally transformed.

You can now develop, execute, and orchestrate your dbt projects entirely within the Snowflake ecosystem. This new approach offers unparalleled simplicity, tighter security, and a truly unified workflow. This is not just a new feature; it's a new way of thinking about analytics engineering.


The "Why": dbt and Snowflake, A Truly Unified Platform

The native integration is a game-changer because it eliminates the friction between the dbt transformation framework and the Snowflake query engine. The strategic benefits are immense:

  • Simplified Architecture: Your entire ELT pipeline now lives in one place. There are no external orchestrators to manage, CI/CD runners to configure for dbt, or servers to patch.

  • Enhanced Security: Credentials and secrets never leave the Snowflake environment. The connection to your Git repository is established via a secure, OAuth-based handshake, eliminating the need for long-lived personal access tokens.

  • Tighter Integration & Orchestration: You can use native Snowflake Tasks to schedule your dbt jobs, creating a seamless, self-contained, and reliable data pipeline without any external dependencies.

  • Unified Monitoring: All dbt activity—every model run, every test—is logged directly in Snowflake's QUERY_HISTORY, providing a single pane of glass for observability and cost management.


The Core Workflow: How It Works

While the underlying technology is sophisticated, the workflow is designed to be elegant and simple.

1. The Connection: A Secure Handshake with Git

The first step is to establish a secure, two-way trust relationship between Snowflake and your Git provider (e.g., GitHub, GitLab). This is done by creating a GIT REPOSITORY INTEGRATION in Snowflake. This process uses a modern OAuth handshake, which is more secure than traditional secret key methods. An administrator in Snowflake and an admin in your Git provider perform a one-time consent action, and from then on, the connection is seamless.

2. The Development Flow: Executing dbt with SQL

Once connected, the entire dbt workflow moves inside Snowflake. You no longer use the dbt command-line interface (CLI). Instead, you execute dbt commands using simple SQL statements. The modeling process in your Git repository, writing SQL and Jinja, remains exactly the same.

-- This is your new "CLI" for dbt, all within Snowflake
USE ROLE DBT_ROLE;
USE WAREHOUSE DBT_WH;

-- Install packages from your packages.yml
EXECUTE DBT DEPS IN PROJECT my_dbt_project;

-- Run your models and tests all at once
EXECUTE DBT BUILD IN PROJECT my_dbt_project;

Snowflake streams the familiar, real-time dbt logs back to you as the query result, so the development experience is both familiar and fully integrated.


Productionizing Your Native dbt Project

Moving from development to a reliable, automated production schedule is where the native integration truly shines.

1. Scheduling: Native, Serverless Orchestration

Scheduling becomes incredibly simple. You can create a native Snowflake Task that directly calls your dbt build command on a CRON schedule. This eliminates the need for external orchestrators like Airflow or dbt Cloud for many common use cases.

-- This task will run your entire dbt build every day at 8 AM UTC.
-- It's a self-contained, serverless production job.
CREATE OR REPLACE TASK run_dbt_daily_build
  WAREHOUSE = DBT_WH
  SCHEDULE = 'USING CRON 0 8 * * * UTC'
AS
  EXECUTE DBT BUILD IN PROJECT my_dbt_project;

ALTER TASK run_dbt_daily_build RESUME;

2. Monitoring: A Single Pane of Glass

Because everything runs inside Snowflake, monitoring is seamless. All queries executed by your dbt project are captured in the QUERY_HISTORY view, complete with dbt's rich metadata injected as a SQL comment.

-- Find all queries run by your dbt project, complete with metadata
SELECT
  query_text,
  user_name,
  role_name,
  start_time,
  total_elapsed_time / 1000 AS duration_sec
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE CONTAINS(query_text, '/* {"app": "dbt",') -- Filter for dbt's injected comment
  AND start_time >= DATEADD(day, -1, CURRENT_TIMESTAMP())
ORDER BY start_time DESC;

This allows you to debug failed runs, identify long-running models, and monitor credit consumption directly within Snowflake, using the same tools you use for everything else.

Final Thoughts

The native dbt Core integration is a landmark feature that solidifies Snowflake as a true, all-in-one platform for analytics engineering. By bringing the entire dbt lifecycle—from installing dependencies to developing, testing, and deploying—inside the data cloud, it eliminates external dependencies, enhances security, and dramatically simplifies orchestration.

This shift allows Analytics Engineers to spend less time managing infrastructure and more time doing what they do best: transforming data into value. For teams building on Snowflake, this is the future—a streamlined, powerful, and unified workflow for building the data products that drive the business.

0
Subscribe to my newsletter

Read articles from Sriram Krishnan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sriram Krishnan
Sriram Krishnan

Sharing lessons, tools & patterns to build scalable, modern data platforms —one post at a time.