0
0
Snowflakecloud~10 mins

Clone use cases (dev, testing, backups) in Snowflake - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Clone use cases (dev, testing, backups)
Original Database/Table
Create Clone
Clone is Independent
Use Clone for Dev/Testing/Backup
Changes in Clone do NOT affect Original
Optionally Refresh or Drop Clone
Start with an original database or table, create a clone that is independent, then use it safely for development, testing, or backups without affecting the original.
Execution Sample
Snowflake
CREATE DATABASE prod_db;
CREATE DATABASE dev_db CLONE prod_db;
-- Use dev_db for testing
DROP DATABASE dev_db;
Create a production database, clone it for development, then drop the clone after testing.
Process Table
StepActionObject StateResult
1CREATE DATABASE prod_dbprod_db createdEmpty database ready for data
2CREATE DATABASE dev_db CLONE prod_dbprod_db unchanged, dev_db clone createddev_db is a snapshot clone of prod_db
3Insert test data into dev_dbprod_db unchanged, dev_db modifiedChanges only in dev_db, prod_db safe
4Run tests on dev_dbprod_db unchanged, dev_db modifiedTesting isolated from prod_db
5DROP DATABASE dev_dbprod_db unchanged, dev_db removedClone removed, prod_db intact
💡 Clone dropped after testing, original database remains unchanged
Status Tracker
ObjectInitialAfter CloneAfter Test Data InsertAfter Drop Clone
prod_dbNot existExists (original)Exists (original)Exists (original)
dev_dbNot existExists (clone of prod_db)Exists (clone with test data)Not exist
Key Moments - 3 Insights
Does modifying the clone affect the original database?
No, as shown in steps 3 and 4 of the execution_table, changes in the clone (dev_db) do not affect the original (prod_db).
Can the clone be used for backup purposes?
Yes, because the clone is a snapshot of the original at creation time, it can serve as a backup without impacting the original data.
What happens when the clone is dropped?
Dropping the clone removes only the clone (dev_db) and leaves the original (prod_db) unchanged, as shown in step 5.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the state of prod_db after step 3?
Aprod_db has test data inserted
Bprod_db remains unchanged
Cprod_db is dropped
Dprod_db is cloned again
💡 Hint
Refer to the 'Object State' column in step 3 of the execution_table
At which step is the clone dev_db removed?
AStep 5
BStep 3
CStep 2
DStep 4
💡 Hint
Check the 'Action' column for when DROP DATABASE dev_db occurs
If you insert data into the clone, what happens to the original database?
AOriginal database also gets the data
BOriginal database is deleted
COriginal database remains unchanged
DOriginal database is renamed
💡 Hint
See steps 3 and 4 in the execution_table for how changes affect prod_db
Concept Snapshot
Snowflake clones create independent copies of databases or tables.
Clones share storage initially but changes are isolated.
Use clones for development, testing, or backups safely.
Dropping a clone does not affect the original.
Cloning is fast and storage-efficient.
Full Transcript
This visual execution shows how Snowflake clones work. First, an original database is created. Then a clone is made, which is an independent snapshot. You can insert test data and run tests on the clone without changing the original. Finally, the clone can be dropped safely. This process supports development, testing, and backup use cases by isolating changes and preserving the original data.