Reputation: 87
In Snowflake:
When reading the documents, I’m interpreting a clone is a unique, independent object that’s identical to the source. So, in my head, I can create a clone and drop the source and be OK. Anyone ever do this in a prod environment?
Thanks for any guidance. We've tested the theory and it doesn't look like there are any side effects with the exception of losing time travel and file loading history on the old source; but we're OK with that.
Upvotes: 1
Views: 712
Reputation: 1774
I guess your use case may be same as the use case I had.
As Simon said it is possible, but with clone, you need to be careful about the access control privileges. Please also note that you will lose load history of the source table. Also if a table is cloned, historical data for the table clone begins at the time/point when the clone was created
Access Control Privileges for Cloned Objects
A cloned object does not retain any granted privileges on the source object itself (i.e. clones do not automatically have the same privileges as their sources). A system administrator or the owner of the cloned object must explicitly grant any required privileges to the newly-created clone.
However, if the source object is a database or schema, for child objects contained in the source, the clone replicates all granted privileges on the corresponding child objects:
For databases, contained objects include schemas, tables, views, etc.
For schemas, contained objects include tables, views, etc.
Upvotes: 1
Reputation: 6269
Yes you can create a clone and drop the "source" of the clone. You might also be able to achieve the same effect by using a transaction too but with simpler code:
begin transaction;
[do operation 1 on source table];
[do operation 2 on source table];
commit;
Upvotes: 2