What you will be able to do
- Deploy, execute and inspect a dbt project object with SQL or the Snowflake CLI
- Configure a CI runner to authenticate to Snowflake and deploy with Snowflake CLI
- Choose between full build and Slim CI for pull-request validation
- Separate dev, CI and prod environments, including per-PR clone databases
1.Deploying and running a dbt project object
dbt Core is an open-source framework for defining, testing and deploying SQL transformations. A dbt project is a set of files in which each model is a SQL or Python file that defines one table or view. Models depend on each other, and the DAG (directed acyclic graph) is the map of those dependencies, with sources and tests attached. dbt Projects on Snowflake runs these transformations as a Snowflake object, so develop, deploy, orchestrate and observe all happen where the data already lives. Snowflake manages the dbt Core and dbt Fusion runtimes. Runs use a virtual warehouse at standard compute cost, with no extra licensing or per-user fees.
A valid project needs a dbt_project.yml, a dbt_projects_profiles.yml or profiles.yml, and model files, stored in a workspace or a connected Git repository. A workspace is the Snowsight editor area that holds a project's files and folders. A connected Git repository is a Git repository clone in Snowflake, which synchronizes files from the remote repository so Snowflake can read them. The profile file defines targets: named sets of connection settings, such as dev and prod, each pointing to a database, schema and warehouse. If both profile files are present, dbt_projects_profiles.yml is the one used. Run dbt deps first to install the packages the project depends on into dbt_packages. Then the lifecycle is a short list of commands:
- Deploy with
CREATE DBT PROJECT ... FROM <source>orsnow dbt deploy - Execute with
EXECUTE DBT PROJECTorsnow dbt execute - Schedule with Snowflake tasks or Apache Airflow
- Inspect with
DESCRIBE DBT PROJECTorSHOW DBT PROJECTS
EXECUTE DBT PROJECT my_dbt_project
ARGS = 'build --select +stg_customers+ --target dev';| Menu option | Executes | Flag |
|---|---|---|
| Execute model | Only the selected model | --select model_name |
| Execute model+ | The model and all downstream dependents | --select model_name+ |
| Execute +model | The model and all upstream parents | --select +model_name |
| Execute +model+ | The model, its parents, and its children | --select +model_name+ |
The project details page in Snowsight always shows the version that is currently deployed. It includes the DAG, compiled SQL, column-level lineage (available after at least one run), schedules and run history with downloadable artifacts. The same deployed object can also run concurrently, which keeps independent slices of data fresh in parallel.
Checkpoint 1 of 6· Fill the gap
You want to build stg_customers along with all of its upstream parents and all of its downstream children, against the dev target. Which selector completes the statement?
EXECUTE DBT PROJECT my_dbt_project
ARGS = 'build --select ? --target dev';A + before the model name selects its upstream parents, and a + after it selects its downstream children. Putting + on both sides runs the model, its parents and its children, the same as the Execute +model+ option in the DAG menu.
Source: docs.snowflake.comCheckpoint 2 of 6· Check yourself
A team's dbt project contains both a profiles.yml and a dbt_projects_profiles.yml, and the two files point to different targets. When the team deploys and runs the project as a dbt project object, which file does Snowflake use?
Either file makes a project valid. When both are present, Snowflake gives precedence to dbt_projects_profiles.yml.
“If both files are present, Snowflake uses dbt_projects_profiles.yml.”Source: docs.snowflake.com
2.Code deployment pipelines with Snowflake CLI
Snowflake CLI is how a CI/CD platform deploys to Snowflake. Snowflake publishes a GitHub Action (generally available) plus a GitLab CI/CD component and an Azure DevOps extension (both in public preview). Each of them installs the CLI on the runner. Jenkins, Bitbucket Pipelines, CircleCI and other systems install it with one shell command, such as uv tool install snowflake-cli.
On the Snowflake side, every integration follows the same pattern. Create a service user, configure how it authenticates, and grant it only the roles it needs to deploy. Workload identity federation with OIDC is the recommended method because the runner gets a short-lived token and the CI system stores no long-lived secret. Where OIDC is not available, use key pair authentication, with the private key held as a CI secret. Password authentication still works for legacy workflows but is not recommended for production CI/CD.
CREATE USER <username>
TYPE = SERVICE
WORKLOAD_IDENTITY = (
TYPE = OIDC
ISSUER = '<ci-platform-issuer>'
SUBJECT = '<ci-platform-subject>'
);Connection settings come from several places, and they override each other in a fixed order. Command-line parameters win over everything. Next come connection-specific environment variables such as SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD, then values in config.toml. Generic variables like SNOWFLAKE_USER apply last. Commit only the skeleton of config.toml, never credentials, and inject secrets through the environment.
The stages below are not specific to dbt. The snow dcm commands act on DCM projects, a separate schema-level object type built from its own definition files, which you plan, deploy and test. Deploying a dbt project object uses snow dbt deploy and snow dbt execute instead. In the Validate stage, snow dcm plan computes what a deployment would change without applying anything, so reviewers can read the result on the pull request.
| Stage | What it does | Example tools |
|---|---|---|
| Validate | Computes the changes without modifying anything; output posted to the PR | snow dcm plan |
| Deploy | Applies validated changes, typically after merge to main | snow dcm deploy; snow sql -f <file>; snow snowpark deploy; snow git execute |
| Verify | Refreshes derived data and runs expectation checks | snow dcm test |
Checkpoint 3 of 6· Check yourself
A pipeline runs on a CI system that cannot issue OIDC tokens to Snowflake. How should its Snowflake service user authenticate?
Snowflake recommends OIDC workload identity federation first. When OIDC is not available, the fallback is key pair authentication with the private key held as a CI secret. Password authentication is only for legacy workflows, and credentials should never be committed to config.toml.
“When OIDC is not available (for example, when you need to support older Snowflake CLI versions or on-premises CI runners), use key pair authentication.”Source: docs.snowflake.com
Checkpoint 4 of 6· Check yourself
The committed config.toml sets user = deploy_svc for the connection a job uses. The runner also exports the generic variable SNOWFLAKE_USER=other_svc, and the snow command passes no user parameter. Which user does Snowflake CLI connect as?
Only connection-specific variables such as SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD override config.toml. Generic variables like SNOWFLAKE_USER have the lowest precedence, so the value in config.toml is used.
“Generic environment variables such as SNOWFLAKE_USER apply last.”Source: docs.snowflake.com
3.Testing and validation: full build versus Slim CI
For dbt projects, CI and CD do different jobs. CI runs on every pull request. It deploys a test instance of the dbt project object into the dev environment and runs either a full build or Slim CI. If any operation fails, the pull request fails, and the developer has to fix it and run again. CD runs after the merge to main and updates the production dbt project object to match the latest code. Optionally, it can also deploy task schedules.
The choice between the two CI paths depends on how much each pull request needs to prove. A full build runs dbt build, which runs the models and their tests, on the whole project in an isolated dev target. It is thorough and simple, but it compiles, runs and tests every model even when only a few have changed, and that cost grows with the project. Slim CI imports state from the latest successful production run, which it reads straight from the production dbt project object with no separate artifact store. It then runs and tests only state:modified+: the models that changed plus everything downstream of them. Unchanged upstream models are deferred, meaning a reference to one resolves to the relation that already exists in production instead of rebuilding it in the CI target.
| Path | What runs | When it wins |
|---|---|---|
| Full build | dbt build on every model and test against an isolated dev target | Small projects, or when simplicity and complete coverage matter most |
| Slim CI | Only state:modified+, with unchanged upstream references deferred to production | Larger projects where faster, cheaper PR validation matters |
Checkpoint 5 of 6· Match them up
A team is setting up CI/CD for its dbt project object. Match each part of the pipeline to what it does.
Tap a term, then the definition that fits it.
CI checks each pull request in dev using either a full build or Slim CI. A full build covers the whole project. Slim CI imports production state and runs only the changed models and everything downstream of them. CD runs only after the merge and updates the production object.
“Import state from the latest successful production execution, run and test only state:modified+, and defer unchanged upstream references to production.”Source: docs.snowflake.com
4.Environment management strategies
A CI/CD setup assumes that dev and prod are separate inside Snowflake. CI writes to a dev environment and CD writes to prod, usually as separate databases or schemas. The dbt project's dbt_projects_profiles.yml or profiles.yml defines matching dev and prod targets, so the same code runs against either one with --target. Per-developer setups, production environment variables and secrets can all live in one Git-versioned env.yml.
A shared dev schema becomes a bottleneck once several pull requests are open at the same time. The Slim CI pattern solves this by giving each pull request its own database, created as a zero-copy clone of production. Every PR then validates against production-shaped data in isolation, and the database can be dropped when the PR closes. Combined with defer-to-production, only the changed models are built inside that clone.
Identity should be separated the same way. Create a dedicated service user for each pipeline environment, for example one per repository or one per environment, and grant only the roles that pipeline needs. Then a CI job cannot write to production by accident. Restrict where the service user can authenticate from with network policies, and make sure a network policy allows inbound access from your Git provider.
Checkpoint 6 of 6· Check yourself
Several pull requests on the same dbt project are open at once, and their CI runs keep colliding in the one shared dev schema. Which environment setup lets each pull request validate against production-shaped data in isolation?
In the Slim CI pattern, each pull request gets its own database, created as a zero-copy clone of production. Every PR then validates in isolation against production-shaped data, and the database can be dropped when the PR closes. Queuing or adding a second shared schema still makes PRs wait for each other or share a schema. Writing CI runs to production breaks the separation between dev and prod.
“a Slim CI workflow that uses per-pull-request zero-copy clone databases”Source: docs.snowflake.com
Sources
(7)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Your project needs a dbt_project.yml, a dbt_projects_profiles.yml or profiles.yml file, and model files, stored in a workspace or a connected Git repository.”
↩︎ Deploying and running a dbt project object“dbt Core is an open-source framework for defining, testing, and deploying SQL transformations.”
↩︎ Deploying and running a dbt project object“Deploy a dbt project object with CREATE DBT PROJECT ... FROM <source> or snow dbt deploy.”
↩︎ Deploying and running a dbt project object“Execute the object with EXECUTE DBT PROJECT or snow dbt execute.”
↩︎ Deploying and running a dbt project object“Executions use a virtual warehouse and incur standard compute costs, with no additional Snowflake licensing or per-user fees.”
↩︎ Deploying and running a dbt project object“Run the same deployed dbt project object concurrently to keep independent data slices in your pipeline fresh.”
↩︎ Deploying and running a dbt project object“Run only changed models and their downstream dependencies to reduce validation time and warehouse use.”
↩︎ Testing and validation: full build versus Slim CI“for a Slim CI workflow that uses per-pull-request zero-copy clone databases.”
↩︎ Environment management strategies“Manage per-developer setups, production environment variables, and secrets in a single, Git-versioned env.yml file.”
↩︎ Environment management strategies“Import the latest successful state directly from a production dbt project object without managing a separate artifact store.”
↩︎ Exam trap 1“If both files are present, Snowflake uses dbt_projects_profiles.yml.”
↩︎ Exam trap 3“If both files are present, Snowflake uses dbt_projects_profiles.yml.”
↩︎ Checkpoint“Build changed models in an isolated CI target while resolving unchanged upstream references to existing production relations, avoiding unnecessary rebuilds.”
↩︎ Prediction“a Slim CI workflow that uses per-pull-request zero-copy clone databases”
↩︎ Checkpoint - 2.https://docs.snowflake.com/en/user-guide/data-engineering/dbt-projects-on-snowflake-manageOfficial docs
“The Directed Acyclic Graph (DAG) shows how dbt models depend on each other”
↩︎ Deploying and running a dbt project object“A SQL or Python file in your models/ directory that defines a table or view.”
↩︎ Deploying and running a dbt project object“The project must be run at least once before column-level lineage is available.”
↩︎ Deploying and running a dbt project object - 3.
“A workspace contains files and folders for your code.”
↩︎ Deploying and running a dbt project object - 4.
“files from the remote repository are synchronized to a Git repository clone in Snowflake”
↩︎ Deploying and running a dbt project object - 5.
“Snowflake recommends workload identity federation (WIF) with OpenID Connect (OIDC) so that no long-lived secrets are stored in the CI system.”
↩︎ Code deployment pipelines with Snowflake CLI“Command-line parameters override everything.”
↩︎ Code deployment pipelines with Snowflake CLI“Do not commit config.toml files that contain credentials.”
↩︎ Code deployment pipelines with Snowflake CLI“Computes the changes that would be applied to the target environment without modifying anything.”
↩︎ Code deployment pipelines with Snowflake CLI“Create a dedicated service user for each pipeline environment (for example, one user per repository or per environment).”
↩︎ Environment management strategies“Password authentication is supported for legacy workflows but is not recommended for production CI/CD.”
↩︎ Exam trap 2“When OIDC is not available (for example, when you need to support older Snowflake CLI versions or on-premises CI runners), use key pair authentication.”
↩︎ Checkpoint“Generic environment variables such as SNOWFLAKE_USER apply last.”
↩︎ Checkpoint - 6.
“You can set role-based access control (RBAC) of the schema-level DCM project object to READ, MONITOR, or OWNERSHIP privileges.”
↩︎ Code deployment pipelines with Snowflake CLI - 7.https://docs.snowflake.com/en/user-guide/data-engineering/dbt-projects-on-snowflake-ci-cdOfficial docs
“If an operation fails, the pull request fails.”
↩︎ Testing and validation: full build versus Slim CI“Import state from the latest successful production execution, run and test only state:modified+, and defer unchanged upstream references to production.”
↩︎ Testing and validation: full build versus Slim CI“CD kicks in: the production dbt project object in Snowflake is updated to reflect the latest code.”
↩︎ Testing and validation: full build versus Slim CI“A separation between dev environment (for CI) and prod environment (for CD) in Snowflake (for example, separate databases or schemas for each environment).”
↩︎ Environment management strategies