What you will be able to do
- Separate production, development and sandbox environments, and promote changes between them using DevOps and DataOps practices
- Design a stage directory structure and the raw, curated and consumption zones that ELT moves data through
- Choose between DCM Projects, Terraform and dbt Projects for managing Snowflake objects as code
- Build a validate, deploy and verify CI/CD pipeline with Snowflake CLI and a service user
- Connect a Git repository through an API integration, roll back a bad release, and bring existing objects under management
- Promote AI/ML pipeline components through dev and production, and plan for what a cloned dev database leaves behind
Key concept
Declarative desired state — You write down in version-controlled files which Snowflake objects should exist. The tool compares that with what exists now, previews the creates, alters and drops, and then applies them. Every environment, pipeline and rollback on this page is built on that loop.
1.Production, development and sandbox environments
An environment strategy decides where a change is allowed to break things. Production serves users, so it should only change through a reviewed, repeatable release. Development is where a team puts changes together and tests them against realistic data. A sandbox is a private scratch space where one engineer edits definitions that nobody else depends on. DevOps with Snowflake connects the three through three principles: define objects as code, check a change before deploying it, and let a CI/CD pipeline run the deployment instead of a person.
Every environment gets the same definitions, so environments differ in configuration, not in code. DCM Projects are built for this. One set of definition files gives version-controlled, repeatable deployments to dev, staging and production, and you create one DCM project object per target environment. Edits in a Workspace or in local files are the sandbox: they change nothing until someone deploys them through a project object.
Separating environments by database keeps dev, test and prod side by side in one account. Each is a database with its own roles and its own warehouse, so an expensive test run never competes with production dashboards (see Virtual warehouse configuration: size, auto-suspend/resume for giving each workload its own warehouse). Separating by account is the stronger boundary. Users, integrations and policies live at account level, so with separate accounts they can differ per environment. Terraform typically owns that layer, with one pipeline per environment. Either way, each pipeline environment gets its own service user that holds only the roles that environment needs.
Realistic test data does not require a full copy. Zero-copy cloning creates a dev, test or CI database from production at almost no storage cost. A feature branch can get its own clone, run the changed pipeline against production-scale data, and drop the clone afterwards. Each alternative breaks a principle. Temporary write access to production tables skips validation entirely. A single shared database refreshed once a quarter is out of date, and one developer's test can corrupt another's. Exporting samples to laptops takes data outside Snowflake's governance and tests against far less data than production holds.
The development lifecycle is one path that every environment shares: commit to a Git branch, preview the change on the pull request, deploy on merge with Snowflake CLI, verify the result, and redeploy the last good tag if the release is bad. Moving an existing hand-built estate onto that path is a migration; the sections below take each step in turn. What the environment strategy adds is that the path never forks. Sandbox, dev and production run the same pipeline against different targets, so a change that passed in dev reaches production as the same code.
AI/ML pipeline components ride the same path, and the CLI deploys more than SQL. The same CLI that deploys DCM projects also deploys Snowpark applications, Snowflake Native Apps and Streamlit apps, so a Cortex-based transformation, a container service or a dashboard needs no separate release process. Three details change how you build the dev environment. A cloned database or schema skips model objects, so a forecast or anomaly detection model trained by an ML function is missing from the clone and must be retrained there before the pipeline runs. A Native App is tested in dev by creating the application object from files on a named stage; adding a version or setting DISTRIBUTION to EXTERNAL triggers the automated security scan, so that belongs to the release step. And compute pools behind Snowpark Container Services jobs should auto-suspend in sandbox and dev, or idle nodes keep billing.
Checkpoint 1 of 8· Check yourself
A team keeps one set of DCM Projects definition files. They want to deploy them to dev, staging and production, and engineers also edit definitions in their own Workspaces. Which setup follows the environment strategy?
Environments should differ in configuration, not in code. So one set of definition files is deployed to each environment through its own DCM project object. Workspace edits are the sandbox and change nothing until someone deploys them through a project object.
“You need a DCM project object for each target environment.”Source: docs.snowflake.com
Checkpoint 2 of 8· Exam question
A DataOps team wants developers to test transformation pipeline changes against production-scale data before merging, without risking production tables or waiting for a nightly data refresh. Which approach best supports this DevOps/DataOps principle?
Correct answer: A — Create a zero-copy clone of the production database per feature branch, run the pipeline changes against it, then drop the clone after validation.
- A. Zero-copy cloning creates a metadata-only copy of production at essentially no extra storage cost, giving each branch an isolated, production-scale environment that can be discarded after testing.
- B. Letting developers write directly to production, even temporarily, risks unrecoverable damage from an untested pipeline and depends on error-prone manual reverts instead of isolation.
- C. A quarterly-refreshed shared database quickly drifts from current production data and forces every developer's tests to collide in the same environment, undermining isolated feature validation.
- D. Exporting samples to local laptops loses production scale and referential integrity, and it also risks moving governed data outside Snowflake's access controls entirely.
2.Data lake directory structure for staged files
Lay out files in a stage, internal or on S3, Azure or Google Cloud Storage, as logical, granular paths. A path starts with details that identify the source (application, region, device group) and ends with the date the data was written. With paths such as s3://bucket_name/application_one/2016/07/01/11/, one COPY command can load any slice of the data (an hour, a day or a whole year) by naming the right prefix.
The layout affects load speed, not just tidiness. S3 sends a directory list with every COPY statement Snowflake runs, so fewer files per directory means a faster COPY. An optional hour level, or even 10–15 minute subfolders, keeps each directory small. Partitioned paths also let you run several COPY statements at once over separate subsets, and reload one region-day without touching the rest. When loading, narrow the path to the most specific level that holds the files you want.
CREATE STAGE my_stage URL='s3://mybucket/United_States/California/Los_Angeles/' CREDENTIALS=(AWS_KEY_ID='1a2b3c' AWS_SECRET_KEY='4x5y6z');The tempting shortcuts fail at scale. If every file sits under one flat prefix, every COPY has to list all of them. One stage per device means thousands of stage objects to manage, when one stage with region and date paths already separates each slice. Random file names with no folders gain nothing and remove the prefixes COPY needs to pick out a subset. Once files have loaded successfully, remove them from the stage with PURGE or REMOVE. That stops them being loaded twice and shrinks what later COPY commands have to scan.
Checkpoint 3 of 8· Exam question
An architecture team is designing the directory structure for an S3-backed external stage that lands IoT sensor files before loading them into Snowflake. Files arrive continuously from thousands of devices across multiple regions, and both COPY INTO performance and future reprocessing need to stay manageable. Which structure should they choose?
Correct answer: A — Partition the stage path by ingestion date and region, like /region=eu/year=2026/month=09/day=17/, and reference that pattern in COPY INTO.
- A. Partitioning by date and region gives COPY INTO a predictable prefix to scan and lets reprocessing target a narrow date range instead of the entire bucket.
- B. A flat, unpartitioned prefix forces COPY INTO and any reprocessing job to list and filter a rapidly growing file set with no structural shortcut, which degrades badly at scale.
- C. Provisioning a stage per device multiplies the number of objects to manage without adding any real isolation benefit, since a shared partitioned stage already scopes data per device through path metadata.
- D. Removing folder structure entirely does prevent name collisions, but it destroys the ability to prune by date or region during loading and reprocessing, which is the actual bottleneck here.
3.Raw, curated and consumption zones
A Snowflake data warehouse is usually split into zones, typically one schema per layer, and data passes through them in order. Each zone does one job. Keeping the jobs separate means you can reprocess, test and govern each step on its own.
| Zone | Holds | Populated by |
|---|---|---|
| Raw (landing) | Source data exactly as received, such as JSON events, unchanged | COPY from stage paths partitioned by date and source |
| Curated (conformed) | Validated, typed, deduplicated tables | SQL transformations, for example dbt models, with data quality expectations attached |
| Consumption | Business-ready aggregates and views for dashboards and apps | Transformations that refresh derived data from the curated zone |
ELT is the order that makes this work in Snowflake: extract and load the raw data first, then transform it inside the platform. The raw zone keeps the data untouched, so a bug in the conforming logic is fixed by rerunning the transformation rather than asking the source to send the data again. Raw JSON order events land unchanged in the raw schema (often called bronze). They are typed and validated into curated tables (silver), then aggregated into consumption tables (gold) that dashboards read.
The wrong designs skip a layer. If BI tools read raw JSON, every tool flattens, types and validates the same data at query time, each in a slightly different way. Dashboard views built straight on files in a stage leave no typed, validated layer to test against. And a zone is only useful if data flows through it. A silver schema used for something other than conformed data, such as query logs, leaves dashboards reading raw data directly.
Checkpoint 4 of 8· Match them up
An order-events pipeline uses ELT across three warehouse zones. Match each term to its role in that design.
Tap a term, then the definition that fits it.
Each zone has one job. The raw zone keeps source data untouched. SQL transformations such as dbt models turn it into validated tables in the curated zone, and the consumption zone serves aggregates built from those tables. Because the raw data stays intact, ELT lets you fix a logic bug by reprocessing.
“they manage SQL transformations rather than the declared state of your objects”Source: docs.snowflake.com
Checkpoint 5 of 8· Exam question
A retail analytics team is designing schema zones in Snowflake to support data warehouse layering. Raw JSON order events land continuously, need light validation and conforming into typed tables, and business-ready aggregates power dashboards. Which zone design best supports this workflow?
Correct answer: A — Land raw JSON in a bronze schema unchanged, conform it into a typed silver schema, then publish curated aggregates in a gold schema for dashboards.
- A. This layered bronze/silver/gold design isolates raw ingestion from conforming logic and from business aggregation, which is exactly the separation of concerns data warehouse zoning is meant to provide.
- B. Pushing JSON parsing and validation into every downstream BI tool duplicates transformation logic per consumer and removes the single conformed layer the rest of the architecture depends on.
- C. Querying an external stage directly for dashboards bypasses Snowflake's typed table performance benefits and leaves no governed, validated layer between raw files and reporting.
- D. Using an audit-log schema in place of a genuine conforming layer means untyped, unvalidated raw data feeds dashboards directly, defeating the purpose of layered zoning.
4.Managing objects as code: DCM Projects, Terraform and dbt
Two declarative tools manage Snowflake objects, and each covers a different layer. DCM Projects run inside Snowflake and are the recommended option for objects inside databases. You write SQL DEFINE statements, plus GRANT statements and ATTACH statements for data quality expectations, and list your environments as deployment targets in manifest.yml. The order of statements does not matter, because Snowflake collects and sorts every DEFINE before it applies anything.
{% for team in teams %}
DEFINE DATABASE {{team.name}}_DB;
DEFINE WAREHOUSE {{team.name}}_WH
WITH
warehouse_size = '{{team.wh_size}}'
auto_suspend = 300;
DEFINE ROLE {{team.name}}_ADMIN;
GRANT OWNERSHIP ON DATABASE {{team.name}}_DB TO ROLE {{team.name}}_ADMIN;
GRANT OWNERSHIP ON WAREHOUSE {{team.name}}_WH TO ROLE {{team.name}}_ADMIN;
{% endfor %}| Consideration | DCM Projects | Snowflake Terraform provider |
|---|---|---|
| Typical scope | Schemas, tables, views, dynamic tables and tasks, plus databases, warehouses and roles | Account-level objects such as users, integrations and policies |
| Resources outside Snowflake | Not supported | Supported through other Terraform providers |
| Authoring language | SQL DEFINE statements with Jinja2 | HCL with modules |
| Where it runs | Inside Snowflake | Outside Snowflake, issuing SQL that appears in query history |
| Multiple environments | Deployment targets and configuration profiles in manifest.yml | Terraform modules and per-environment pipelines |
Many organisations use both: Terraform for the account layer that a platform team owns, and DCM Projects for the objects that data engineers own. The one rule is that each object belongs to exactly one tool. Otherwise the two keep overwriting each other's version of the same object. Both tools preview changes before applying them. DCM's preview reads internal object state, so it catches changes to attributes that SHOW and DESCRIBE do not return, which Terraform misses. dbt Projects do a different job: they manage SQL transformations, not object state, and run alongside either tool. For a one-off change, CREATE OR ALTER creates an object or alters it to match the statement.
Checkpoint 6 of 8· Check yourself
Your platform team already uses Terraform to manage users, integrations, policies, and a cloud storage bucket together with the storage integration that reads from it. Data engineers now want to adopt DCM Projects for schemas, tables and dynamic tables. How should the two tools be split?
Terraform covers the account layer and resources outside Snowflake, which DCM Projects does not support. DCM Projects are the recommended option for objects inside databases. Each object must belong to exactly one tool, or the two keep overwriting each other's version of the same object.
“Manage each object with only one tool, so that the two don’t compete to reconcile the same state.”Source: docs.snowflake.com
5.CI/CD pipelines with Snowflake CLI
Snowflake CLI is the client a pipeline calls. SnowSQL is the legacy client and gets no new features. A CI runner runs snow commands without user interaction (see Snowflake CLI and SnowSQL). Snowflake provides integrations for GitHub Actions (generally available) and for GitLab and Azure DevOps (both in preview). On Jenkins, Bitbucket, CircleCI or any other runner that can run a shell command, the CLI installs with one command.
| Stage | When it runs | Example commands |
|---|---|---|
| Validate | On a pull request, with the output posted as a PR comment for reviewers | snow dcm plan |
| Deploy | After a merge to the main branch | snow dcm deploy, snow sql -f <file>, snow snowpark deploy, snow git execute |
| Verify | After the deploy; refreshes derived data and runs expectation checks | snow dcm test |
On the Snowflake side, every integration is set up the same way. Create a service user for the pipeline, give it an authentication method, and grant it only the roles it needs to deploy. Workload identity federation is the recommended method because no long-lived secret sits in the CI system. Key pair authentication is the fallback for older CLI versions or on-premises runners. Password authentication is not recommended for production CI/CD.
CREATE USER <username>
TYPE = SERVICE
WORKLOAD_IDENTITY = (
TYPE = OIDC
ISSUER = '<ci-platform-issuer>'
SUBJECT = '<ci-platform-subject>'
);The rest of the hardening is just as concrete. Use one service user per repository or environment. Add a network policy that limits which source IPs it can sign in from. Commit a config.toml that holds only the connection settings, and pass secrets in as environment variables. When the same setting comes from several places, the order of precedence is: command-line parameters first, then connection-specific environment variables, then config.toml, then generic variables such as SNOWFLAKE_USER.
Checkpoint 7 of 8· Fill the gap
A CI pipeline needs its own Snowflake identity that authenticates with the CI platform's short-lived OIDC token. Which value completes this user definition?
CREATE USER <username>
TYPE = ?
WORKLOAD_IDENTITY = (
TYPE = OIDC
ISSUER = '<ci-platform-issuer>'
SUBJECT = '<ci-platform-subject>'
);Every CI/CD integration starts by creating a service user for the pipeline to authenticate as, so the user's TYPE is SERVICE. OIDC goes in the nested WORKLOAD_IDENTITY clause as the authentication method. It is not the user type.
Source: docs.snowflake.com6.Git integration, rollback and migration
Snowflake's Git integration makes Snowflake one more client of your remote repository. Setting it up takes three objects. First, an API integration whose API_PROVIDER is git_https_api. Second, a secret holding the credentials (best practice is a personal access token), which the integration must allow. Third, a GIT REPOSITORY object pointing at the HTTPS origin URL. GitHub, GitLab, Bitbucket, Azure DevOps and AWS CodeCommit are supported, including at custom URLs such as a corporate Git server, for repositories up to 2 GB.
CREATE OR REPLACE GIT REPOSITORY snowflake_extensions
API_INTEGRATION = git_api_integration
GIT_CREDENTIALS = git_secret
ORIGIN = 'https://github.com/my-account/snowflake-extensions.git';The clone holds every branch, tag and commit of the remote repository. After a fetch you can run .sql files from a chosen branch or tag with EXECUTE IMMEDIATE FROM. You can also use repository files as handler code for procedures, functions and tasks, and push commits back from Workspaces, notebooks and Streamlit apps. A pipeline's deploy stage can therefore run snow git execute against a release tag instead of uploading the files itself.
A rollback is a redeploy. The definitions live in version control, so you check out the last good commit or tag and run it through the same pipeline. Declarative tools and CREATE OR ALTER turn that older file into the alters needed to return to it. Only the code goes back. Rows that a bad release deleted or overwrote come back through Time Travel, using UNDROP or an AT/BEFORE query.
Migration usually means bringing objects that were built by hand or by scripts under managed deployment. Snowflake Labs provides two experimental migration tools, a Cortex Code skill and a stored procedure. Both run GET_DDL against a database or schema and generate DEFINE statements from the result. Next, run PLAN to compare those statements with the live objects, and refine them until the plan shows no differences. Then run a DEPLOY with zero changes, which takes over the existing objects without rebuilding them. Existing SQL deployment scripts convert the same way, by rewriting their statements with the DEFINE keyword.
Checkpoint 8 of 8· Put it in order
Put these steps in order to bring a schema of hand-built production objects under DCM Projects management without rebuilding them.
- 1.Run a DEPLOY with zero changes, which takes over the existing objects without rebuilding them
- 2.Refine the DEFINE statements until the plan shows no differences
- 3.Run GET_DDL against the schema and generate DEFINE statements from the result, using the migration skill or stored procedure
- 4.Run PLAN to compare the generated DEFINE statements with the live objects
The migration tools first turn GET_DDL output into DEFINE statements. PLAN then shows where those statements differ from the live objects, and you refine them until there are no differences. Only then does a zero-change DEPLOY take over the objects, so nothing is dropped or recreated.
“runs PLAN to compare them against the live objects, helps you refine the DEFINE statements based on the diff, runs DEPLOY with zero changes”Source: docs.snowflake.com
Sources
(10)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“version-controlled, repeatable deployments across environments, such as dev, staging, and production”
↩︎ Production, development and sandbox environments“You need a DCM project object for each target environment.”
↩︎ Production, development and sandbox environments“Changes only take effect in Snowflake after you deploy them through a DCM project object.”
↩︎ Production, development and sandbox environments“The order and location of DEFINE statements within a project don’t affect the results.”
↩︎ Managing objects as code: DCM Projects, Terraform and dbt“Warehouse size doesn’t affect the latency of DCM Projects execution. An X-Small warehouse is sufficient.”
↩︎ Managing objects as code: DCM Projects, Terraform and dbt“runs DEPLOY with zero changes to adopt the objects into DCM Projects”
↩︎ Git integration, rollback and migration“runs PLAN to compare them against the live objects, helps you refine the DEFINE statements based on the diff, runs DEPLOY with zero changes”
↩︎ Checkpoint - 2.
“Validate before you deploy. Preview proposed changes in a plan step before applying them to your account.”
↩︎ Production, development and sandbox environments“they manage SQL transformations rather than the declared state of your objects”
↩︎ Raw, curated and consumption zones“Terraform for the account-level layer that platform teams own, and DCM Projects for the objects inside databases that data engineers own.”
↩︎ Managing objects as code: DCM Projects, Terraform and dbt“a change to an attribute that SHOW and DESCRIBE don’t return won’t appear in its plan”
↩︎ Managing objects as code: DCM Projects, Terraform and dbt“you can roll back changes to a previous version by executing a previous version of the file.”
↩︎ Git integration, rollback and migration“Declare the desired state of your Snowflake objects in version-controlled files.”
↩︎ Key concept“Manage each object with only one tool, so that the two don’t compete to reconcile the same state.”
↩︎ Exam trap 1“you can roll back changes to a previous version by executing a previous version of the file.”
↩︎ Exam trap 3“Manage each object with only one tool, so that the two don’t compete to reconcile the same state.”
↩︎ Checkpoint - 3.
“Create a dedicated service user for each pipeline environment (for example, one user per repository or per environment).”
↩︎ Production, development and sandbox environments“automate Snowflake deployments for DCM projects, Snowpark applications, Snowflake Native Apps, and standalone SQL scripts”
↩︎ Production, development and sandbox environments“Refreshes derived data and runs expectation checks to confirm the deployment produced the expected results.”
↩︎ Raw, curated and consumption zones“A Snowflake CI/CD pipeline typically progresses through three stages: validate proposed changes on a pull request, deploy them on merge, and verify the result.”
↩︎ CI/CD pipelines with Snowflake CLI“Do not commit config.toml files that contain credentials.”
↩︎ CI/CD pipelines with Snowflake CLI“Password authentication is supported for legacy workflows but is not recommended for production CI/CD.”
↩︎ Exam trap 2“Snowflake recommends workload identity federation (WIF) with OpenID Connect (OIDC) so that no long-lived secrets are stored in the CI system.”
↩︎ Prediction - 4.
“Snowflake CLI supports Snowpark Python user-defined functions and stored procedures, warehouses, and Streamlit apps.”
↩︎ Production, development and sandbox environments“Snowflake will only add new features and enhancements to Snowflake CLI.”
↩︎ CI/CD pipelines with Snowflake CLI - 5.
“When cloning a schema or database, model objects are skipped.”
↩︎ Production, development and sandbox environments“When cloning a schema or database, model objects are skipped.”
↩︎ Exam trap 4 - 6.
“Test the new version of your application package by creating the application object locally by using the CREATE APPLICATION command.”
↩︎ Production, development and sandbox environments“Compute pools should be set to automatically suspend in combination with Snowpark Container Services jobs to avoid idle compute nodes.”
↩︎ Production, development and sandbox environments - 7.
“partition the data in your internal (i.e. Snowflake) stage or external locations (S3 buckets or Azure containers) using logical, granular paths”
↩︎ Data lake directory structure for staged files“reducing the number of files in each directory improves the performance of your COPY statements”
↩︎ Data lake directory structure for staged files“Removing files ensures they aren’t inadvertently loaded again.”
↩︎ Data lake directory structure for staged files“When planning regular data loads such as ETL (Extract, Transform, Load) processes or regular imports of machine-generated data”
↩︎ Raw, curated and consumption zones - 8.
“This allows you to execute concurrent COPY statements that match a subset of files, taking advantage of parallel operations.”
↩︎ Data lake directory structure for staged files“narrow the path to the most granular level that includes your data”
↩︎ Data lake directory structure for staged files - 9.
“The API integration you specify here must have an API_PROVIDER parameter whose value is set to git_https_api.”
↩︎ Git integration, rollback and migration - 10.
“The clone includes all branches, tags, and commits from the remote repository.”
↩︎ Git integration, rollback and migration“Execute immediate from .sql files.”
↩︎ Git integration, rollback and migration