|
| 1 | +--- |
| 2 | +name: devops-guidance |
| 3 | +title: Snowflake DevOps Guidance |
| 4 | +summary: Opinionated guidance on CI/CD, Database Change Management, and deployment tooling for Snowflake. |
| 5 | +description: "Use when choosing deployment tools, setting up CI/CD pipelines, comparing schemachange/Flyway/Liquibase/Terraform, deciding between imperative and declarative approaches, deploying simple vs complex Snowflake objects, evaluating DCM Projects, or asking about Snowflake DevOps best practices. Triggers: devops, CI/CD, database change management, DCM, schema migration, deployment pipeline, schemachange, flyway, liquibase, terraform, snowflake CLI deploy, DCM Projects, imperative vs declarative, rollback, infrastructure as code, database versioning." |
| 6 | +tools: |
| 7 | + - Read |
| 8 | + - Write |
| 9 | + - Edit |
| 10 | + - Bash |
| 11 | + - snowflake_sql_execute |
| 12 | + - snowflake_object_search |
| 13 | +prompt: "How should I set up a CI/CD pipeline for Snowflake schema changes?" |
| 14 | +language: en |
| 15 | +status: Published |
| 16 | +author: Snowflake Solutions Team |
| 17 | +type: snowflake |
| 18 | +--- |
| 19 | + |
| 20 | +# Snowflake DevOps Guidance |
| 21 | + |
| 22 | +Opinionated technical advice on Database Change Management (DCM), CI/CD pipelines, and deployment tooling for Snowflake projects. |
| 23 | + |
| 24 | +## Overview |
| 25 | + |
| 26 | +This skill answers questions about how to deploy and version Snowflake objects safely. It covers terminology, tool selection (schemachange, Flyway, Liquibase, Terraform, Snowflake CLI), imperative vs declarative tradeoffs, native Snowflake features (CREATE OR ALTER, EXECUTE IMMEDIATE FROM, DCM Projects), and where the deployment process should run. |
| 27 | + |
| 28 | +Load `references/raw-guidance.md` for the full reference content (terminology, tool landscape, deployment approaches, native features, curated links). |
| 29 | + |
| 30 | +## When to Use |
| 31 | + |
| 32 | +- Setting up CI/CD or deployment pipelines for Snowflake |
| 33 | +- Choosing a deployment tool (schemachange, Flyway, Liquibase, Terraform) |
| 34 | +- Deciding between imperative and declarative approaches |
| 35 | +- Deploying simple vs complex objects (Streamlit, Notebooks, Snowpark procs, dbt projects) |
| 36 | +- Evaluating DCM Projects, EXECUTE IMMEDIATE FROM, or Git Repositories |
| 37 | +- Planning rollback / failure recovery strategy |
| 38 | + |
| 39 | +## Key Positions |
| 40 | + |
| 41 | +1. **Imperative for pipelines.** Declarative tools (especially Terraform) should not drive CI/CD for most scenarios. |
| 42 | +2. **Declarative still has value** for storing definitions in source control, generating initial scripts, and drift detection. |
| 43 | +3. **Snowflake CLI (`snow`)** is the primary tool for complex objects: Streamlit, Notebooks, Snowpark stored procedures, dbt Projects. |
| 44 | +4. **schemachange** is the recommended starting point for imperative DCM on Snowflake. |
| 45 | +5. **External CI/CD tools** (GitHub Actions, GitLab CI, Azure DevOps, Jenkins) beat running deployments from inside Snowflake. |
| 46 | +6. **Roll forward, not back.** Undo/rollback features are unreliable for databases — fail forward with a new migration. |
| 47 | +7. **Combining tools is normal.** Real pipelines often mix a DCM tool, the Snowflake CLI, and others. |
| 48 | +8. **DCM Projects** are not recommended for most deployment scenarios today (preview, limited object coverage, declarative limitations). |
| 49 | +9. **EXECUTE IMMEDIATE FROM** is a script runner, not a DCM tool. |
| 50 | +10. **Git Repository integration** is a development feature, not a deployment feature. |
| 51 | + |
| 52 | +## Decision Framework |
| 53 | + |
| 54 | +| Scenario | Recommendation | |
| 55 | +|----------|----------------| |
| 56 | +| New to DCM on Snowflake | schemachange | |
| 57 | +| Already on Flyway / Liquibase | Stay on it | |
| 58 | +| Only simple objects (tables, views, schemas) | Any imperative DCM tool | |
| 59 | +| Only complex objects | Snowflake CLI | |
| 60 | +| Mixed simple + complex | schemachange + Snowflake CLI in migration scripts | |
| 61 | +| Cloud infra adjacent to Snowflake | Terraform is acceptable for infra-adjacent objects | |
| 62 | +| Account-level / environment provisioning | Terraform is acceptable | |
| 63 | +| No CI/CD tool, limited engineering capacity | DCM Projects may be acceptable, with caveats | |
| 64 | + |
| 65 | +## Terraform Nuance |
| 66 | + |
| 67 | +- Generally not recommended for object-level DCM, especially for newcomers. |
| 68 | +- Acceptable for two scenarios: cloud-infra-adjacent objects and environment/account management. |
| 69 | +- Real challenges: steep learning curve, state file management, incomplete provider coverage, HCL format lock-in. |
| 70 | + |
| 71 | +## Important Distinctions |
| 72 | + |
| 73 | +- **DCM ≠ IaC.** Database Change Management is not Infrastructure as Code. |
| 74 | +- **Git Repository ≠ DevOps.** Connecting Snowflake to Git is not a deployment pipeline. |
| 75 | +- **CREATE OR ALTER ≠ DCM tool.** Helpful SQL syntax, not a complete solution. |
| 76 | +- **EXECUTE IMMEDIATE FROM ≠ pipeline.** It runs scripts; it doesn't track state or order. |
| 77 | +- **Snowflake CLI ≠ SnowSQL.** `snow` is current; `snowsql` is the older, deprecated CLI. |
| 78 | + |
| 79 | +## Common Mistakes |
| 80 | + |
| 81 | +- Using Terraform to manage tables, views, and stored procedures in CI/CD — leads to brittle state files and partial drift. |
| 82 | +- Treating Git Repositories + EXECUTE IMMEDIATE FROM as a deployment pipeline — no migration ordering, no state tracking, no idempotency guarantees. |
| 83 | +- Skipping a DCM tool because CREATE OR ALTER exists — you still need migration history and ordering. |
| 84 | +- Relying on rollback features (Flyway undo) — database rollbacks frequently fail; design for forward-only migrations. |
| 85 | +- Mixing simple and complex objects in one declarative tool — Streamlit, Notebooks, and Snowpark procs need the Snowflake CLI deploy commands. |
| 86 | +- Running deployments from inside Snowflake worksheets — no audit trail, no PR review, no environment promotion. |
| 87 | +- Following the Snowflake DevOps landing page's EXECUTE IMMEDIATE FROM example as a production pattern — it's a primitive, not a pipeline. |
| 88 | + |
| 89 | +## Resources |
| 90 | + |
| 91 | +Point users to the schemachange repo, Flyway/Liquibase Snowflake docs, and Snowflake CLI deploy guides. Warn about outdated material that frames Git Repositories + EXECUTE IMMEDIATE FROM as a complete DevOps solution. |
| 92 | + |
| 93 | +## Output |
| 94 | + |
| 95 | +Clear, opinionated DevOps guidance with specific tool recommendations, decision criteria, and warnings about common anti-patterns. Ask a clarifying question first when the scenario is ambiguous (object types, team size, existing tooling). |
0 commit comments