Understanding orchestration for dbt Projects on Snowflake¶
Orchestration is the process of scheduling, sequencing, and monitoring your deployed dbt project object executions. Every orchestration approach for dbt Projects on Snowflake uses the same underlying mechanism: the EXECUTE DBT PROJECT SQL command. Whether you use Snowflake tasks or an external tool like Apache Airflow, the orchestrator’s job is to call that command at the right time, in the right order, with the right parameters.
You have two paths:
- Snowflake tasks: Native scheduling with no external infrastructure. Best for teams that want to reduce operational overhead and standardize on Snowflake.
- External orchestrators (Apache Airflow, Prefect, Dagster): For teams with existing orchestration infrastructure or cross-system workflows that extend beyond Snowflake.
Choosing an orchestration approach¶
| Consideration | Snowflake tasks | Apache Airflow |
|---|---|---|
| Infrastructure | None. Fully managed by Snowflake. | Self-managed Airflow cluster or managed service. |
| Monitoring | Built-in Snowsight run history, event table, and per-query dbt artifact access. | Airflow UI, plus custom integrations. |
| Scheduling | CRON expression, fixed interval, AFTER (task chaining), or triggered when a stream has new data. | Airflow scheduler with DAG-level configuration. |
| Multi-step pipelines | AFTER clause chains tasks into a graph. | DAG dependencies with trigger rules (for example, all success, or one failed). |
| Dynamic parameters | --vars in the ARGS string of EXECUTE DBT PROJECT. | Airflow Jinja templates interpolated into SQL or CLI commands. |
| Cost | Warehouse credits for task execution only. | Airflow infrastructure cost plus warehouse credits. |
| Best for | Teams that are Snowflake-native, starting fresh, or consolidating tools. | Teams with existing Airflow DAGs or cross-system workflows. |
Built-in monitoring at the dbt project object level¶
Regardless of how a dbt project object is executed, you get the same observability and management capabilities. These features are tied to the deployed dbt project object itself, not to the orchestrator:
- Run history in Snowsight: In the navigation menu, select Transformation > dbt Projects to view run history, task graphs, and query details for every execution of the dbt project object, whether triggered by a task, Airflow, or an ad-hoc SQL call.
- Project DAG with column-level lineage: Browse the model dependency graph from the project details page, inspect compiled SQL, and trace column-level lineage powered by Snowflake Horizon Catalog.
- Event table logging and tracing: Snowflake writes log entries and trace spans for each execution to the account’s active event table. Query the event table live during a run or after completion to diagnose failures.
- Programmatic access to dbt artifacts: Use
SYSTEM$LOCATE_DBT_ARTIFACTS to retrieve
manifest.json,run_results.json, and log files programmatically. - Cortex Code integration: Use Cortex Code to inspect the files of your deployed dbt project object, debug production failures, and answer questions about your pipeline.
For details on enabling and using these features, see Monitor dbt Projects and View and manage information for existing dbt Projects.
Orchestrate with Snowflake tasks¶
Snowflake tasks provide native scheduling for dbt project object execution. You don’t need to provision or manage any external infrastructure. Create a task, set a schedule, and Snowflake handles the rest.
Benefits¶
- No infrastructure to provision or manage.
- Built-in monitoring in Snowsight with run history, task graphs, and query-level execution details.
- RBAC-governed scheduling: control who can create, own, and resume tasks.
- Built-in retry logic and alerting through task graphs.
Tasks can also make external calls (for example, triggering a downstream API) through a stored procedure, but this requires configuring external access integrations and network policies.
Schedule from Snowsight¶
You can create, view, and manage tasks to run a deployed dbt project object on a schedule from two places in Snowsight: Workspaces or the object details page of the dbt project object. For instructions, see Schedule execution of dbt project objects on Snowflake.
Create a simple scheduled task¶
The following example creates a task that runs your deployed dbt project object every six hours:
Resume the task to activate it:
Create a task graph with multiple steps¶
Use the AFTER clause to chain tasks into a task graph. The following
example creates a two-step pipeline that runs models first, then runs tests after the models complete:
When the root task fires, it runs all models first. Afterwards, the next task runs automatically. If the first task fails, the next task doesn’t execute.
Orchestrate with Apache Airflow¶
If your team already runs Apache Airflow for other pipelines, you can integrate dbt Projects on Snowflake into your existing DAGs. This guide uses Airflow as the example, but any tool that can issue SQL to Snowflake on a schedule can orchestrate dbt project object executions.
When to use Airflow¶
- Your team already manages Airflow for other data pipelines.
- dbt execution or Snowflake platform is one step in a larger cross-system workflow (for example, ingest data from an external source, then run dbt, then trigger a downstream system).
- You need Airflow-specific features like complex branching or external sensors.
If your team is just getting started with dbt or orchestration, Snowflake tasks are a simpler option with no external infrastructure to manage.
Prerequisites¶
Before you begin, make sure you have:
- A deployed dbt project object on Snowflake.
- Apache Airflow with the
apache-airflow-providers-snowflakepackage installed. - A Snowflake connection configured in Airflow with the account, user, authentication credentials (key pair recommended for production), warehouse, database, schema, and role.
- The role used in the Airflow connection must have the EXECUTE DBT PROJECT privilege on the dbt project object. For more information, see Access control for dbt Projects.
Configure the Snowflake connection in Airflow¶
When setting up the Snowflake connection in your Airflow admin panel or environment, configure the following fields:
- Connection type: Snowflake
- Account: Your Snowflake account identifier (for example,
myorg-myaccount) - Login: The user or service account name
- Authentication: Key pair authentication is recommended for production. You can also use password.
- Warehouse: The warehouse to use for the
EXECUTE DBT PROJECTcommand - Database: The database containing your dbt project object
- Schema: The schema containing your dbt project object
- Role: A role with the EXECUTE DBT PROJECT privilege on the dbt project object
Tip
Use a dedicated service account (for example, airflow_service_user) for production DAGs. This keeps
task privileges governed in one place and prevents broken pipelines when team members leave.
Option 1: Use SQLExecuteQueryOperator (recommended)¶
The SQLExecuteQueryOperator from the Airflow Snowflake provider runs SQL statements directly through a
Snowflake connection. This is the simplest approach because it requires only a SQL connection with no
additional CLI installation.
Simple DAG: run then test¶
The following DAG runs dbt models daily at 6 AM, then runs tests after the models complete:
Sensor-triggered DAG: wait for upstream data¶
The following DAG uses an S3 sensor to wait for a file to land in an external bucket before running the dbt project. This could be new source data landing from an ingestion pipeline or an Iceberg catalog update. Teams often choose external orchestrators like Airflow when they need to react to events in external systems that Snowflake tasks can’t observe natively.
Option 2: Use BashOperator with Snowflake CLI¶
If the Snowflake CLI is already installed in your Airflow worker environment, you can use the BashOperator
to call snow dbt execute directly. This approach is useful when you want CLI-native features like
--run-async.
Basic example¶
Note
The BashOperator approach requires Snowflake CLI version 3.13.0 or later installed in the Airflow
worker environment. The --connection flag specifies a named connection defined in
~/.snowflake/config.toml. In production, commit only an empty connection skeleton and supply
credentials through environment variables using the format SNOWFLAKE_CONNECTIONS_<NAME>_<PARAMETER>.
For details on defining connections, see
Managing Snowflake connections.
Considerations¶
- Serverless tasks can’t execute dbt project objects. You must specify a warehouse when creating a task that executes the EXECUTE DBT PROJECT command.
- The two-role model applies regardless of orchestrator. Every
EXECUTE DBT PROJECTstatement involves a calling role (the task owner or Airflow connection role) and theprofiles.ymlrole (which controls what the dbt run can access). For details, see the orchestration section in Best practices for dbt Projects on Snowflake. - Align your warehouse configuration. Use the same warehouse in both your task definition (or Airflow
connection) and your
profiles.ymltarget. If they differ, both warehouses wake up for a single run.