r/devops • u/Top-Needleworker8557 • Jul 13 '26
Career / learning Help in implementing CICD for Snowflake Objects.
Hey all. I am building a POC for deploying Snowflake objects like table, stream, task, stage etc... to multiple environments like DEV/QA (single only) & PROD with the help of CICD and used Github actions for it.
I have never built something like this before and never worked on project consisting CICD in it.
So, I have used Schemachange library to detect schemachange and sqlfluff for SQL linting. Also using some python scripts to build backup of existing DB snapshot before deployment and rollback script if anything break during deployment.
I am testing this in DEV env only but i am confused how can i validate the objects that are being created with schemachange library and SQL files (which contain DDLs of objects). like how can I verify that the object created is correctly build in the target or not.
and if there is any other suggestion / best practice you guys have that is also welcome on how can i improve the CICD pipeline for it.
Thanks
Bots and moderators I am 100% human only don't remove my post!!!
1
u/ScholarMedical Jul 14 '26
FYI the piece most people miss: you need a manifest file — just yaml or json — that documents each object type, name, and a few expected properties. After deploy, query Snowflake's metadata views and compare actual state to the manifest. Fail the job on any mismatch.
Why this matters at scale: schemachange proves the SQL executed, but it doesn't prove the object *works*. A task can be created but suspended. A stream can exist but point to a dropped table. A stage can be configured but inaccessible. Post-deploy validation catches all of that. Have you thought about versioning the manifest alongside your DDL, or are you planning to keep it separate?
1
u/ClueDry8701 Jul 23 '26
query schemachange's change_history table to confirm the migration ran.. but that only proves execution, not correctness. add a describe and get_ddl check right after deploy and diff against expected schema..
0
u/Thick-Paramedic9636 Jul 13 '26
For validating the objects themselves, the key is to separate two questions that are easy to conflate:
verifysubcommand only tests connectivity and config, not whether your objects came out correctly, so don't expect it to answer this.The reliable way to handle the second part is to include a post-deploy validation step in your Action that queries Snowflake's metadata and asserts it, failing the job if anything is off. Useful sources:
SHOW TABLES / STREAMS / TASKS / STAGES IN SCHEMA ...to confirm existence and basic properties.INFORMATION_SCHEMA.COLUMNSto assert a table's columns and data types match what you expect.GET_DDL('TABLE', 'DB.SCHEMA.OBJ')to pull the actual definition back out and diff it against your expected DDL, good for catching silent differences.One gotcha that bites people here: "created" doesn't mean "working." Tasks are created suspended, so they need an explicit
ALTER TASK ... RESUMEto validate the state, not just existence. Streams can be created fine, but go stale if not consumed within the retention window, so check the STALE column inSHOW STREAMS.A few things that'll harden the pipeline overall:
CREATE DATABASE db_backup CLONE dbbefore the deploy gives you a full restore point, and Time Travel recovers dropped/changed objects within the retention window. Far less to maintain than hand-rolled backup logic.For a first POC, this is already a solid setup. Most people don't even think about validation and rollback.
4
u/[deleted] Jul 13 '26
[removed] — view removed comment
1
u/[deleted] Jul 13 '26
[removed] — view removed comment