【问题标题】:Can a table cloned in Snowflake become the source?在 Snowflake 中克隆的表可以成为源吗?
【发布时间】:2020-08-27 14:12:18
【问题描述】:
在雪花中:
- 我要克隆源代码
- 对克隆执行操作
- 将克隆转为源
- 删除原始来源
在阅读文档时,我将克隆解释为与源相同的唯一、独立对象。所以,在我的脑海里,我可以创建一个克隆并删除源代码,然后就可以了。有人在 prod 环境中这样做过吗?
感谢您的指导。我们已经测试了这个理论,除了丢失时间旅行和旧源上的文件加载历史之外,它看起来没有任何副作用;但我们可以接受。
【问题讨论】:
标签:
snowflake-cloud-data-platform
cloning
【解决方案1】:
是的,您可以创建一个克隆并删除克隆的“源”。您也可以通过使用事务来实现相同的效果,但代码更简单:
begin transaction;
[do operation 1 on source table];
[do operation 2 on source table];
commit;
【解决方案2】:
我猜你的用例可能和我的用例一样。
正如西蒙所说,这是可能的,但使用克隆,您需要注意访问控制权限。另请注意,您将丢失源表的加载历史记录。此外,如果克隆表,则表克隆的历史数据从创建克隆的时间/点开始
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.