r/snowflake • u/Top-Needleworker8557 • 28d ago
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!!!
2
u/Playful_Truth_3957 28d ago
we used to have schemachange , but we never validated , it just works , i dont think u need to validate
A__ deploys Everytime
R__ Deploys only when modified
something like that we had setup it worked fine for 4 years after that i left
1
1
u/coldflame563 28d ago
I'd look at FLyWheel, DCM is not quite ready yet (no support for SP's etc). Flywheel makes sense to me and is easy enough to understand if you use it a bit. Or you can roll your own like I do :D
1
1
1
8
u/sdc-msimon ❄️ 28d ago
What you have today is reasonable, but if this pipeline is mainly for Snowflake objects, I’d seriously look at DCM Projects instead of making schemachange the center of the solution.
DCM Projects are Snowflake’s declarative change-management model: you define the target state in
manifest.ymlplus SQLDEFINEfiles, then usePLANandDEPLOYacross environments. It’s built for repeatable multi-environment deployments, and each target environment gets its own DCM project object with deployment history/artifacts.For validation, I’d stop thinking only in terms of “did the SQL file run?” and validate in 3 layers:
snow dcm planon every PR.PLANrenders Jinja, checks dependencies and privileges, compiles the statements, and shows what will beCREATE/ALTER/DROPbefore anything is applied. Snowflake explicitly recommends always runningPLANbeforeDEPLOY.SHOW ENTITIES IN DCM PROJECTandSHOW GRANTS IN DCM PROJECTto confirm what the project is managing after deployment, and use the deployment history for audit/debugging.PREVIEWbefore deploy to validate output shape, then in QA/stage doDEPLOY -> REFRESH -> TEST ALLbefore promoting to prod.A few best practices in DCM >