Zero-Copy Cloning: Snowflake cloning is a meta data-only operation, there is no physical data copied from one environment to another, clone data point out to the actual database and further CRUD operations keep separately in the new environment which do not affect the old data, it is important to note that there is no data movement during a clone operation, only creation of new metadata. The metadata for these new database objects simply point back to the original source data. There is no additional cost when creating a clone. You will incur the cost of storage when DML ops is applied to the cloned data.

Create a clone of the table:

CREATE OR REPLACE TABLE demo_db.public.employees_clone CLONE employees;

Create a clone of the database:

CREATE or replace DATABASE demo_db_clone CLONE demo_db;

Clone objects are writable and independent of clone source database, changes made on either cloned object or source object are not a part of others. 😊 interesting. These makes clone very easy and without any cost.

There are some restrictions while cloning of objects or databases:

Ø Network policy, Resource Monitor, Warehouse Objects and other account level objects are out of scope during cloning operations.

Ø The database level grants are not inherited from the source databases, they are reset with the ownership privileges.

Ø Table objects in a clone that utilizes SEQUENCE objects are not automatically updated to reference cloned objects. You will need to manually update these references in the cloud database as follows:

Alter table test
Alter column <sequence> set default clone_db.clone_schema.original_sequencename.nextval

Ø Internal stages and created Pipes with Internal stages can not be cloned.

Ø External table are out of scope of cloning.

Ø If You can create a temporary stage, which is also not in cloning scope.

It is highly recommended that such objects are scripted and ideally version controlled so that they can be easily ported and reused.


Vidit — A data scientist in snowflake data warehouse



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store