从另一个雪花数据库中的一个数据库创建所有表的结构
Creating structure of all tables from one database in other snowflake database
我在一个雪花帐户上有两个数据库。数据库 db1 的架构 sch_a 和 db2 的架构 sch_b。我想从 db1,模式 sch_a 到 db2,sch_b 创建所有表。如何将所有表从一个数据库移动到另一个数据库?我只需要没有数据的表结构,所以空表。提前谢谢你。
您可以使用 GET_DDL 或 CREATE … CLONE
-- THis will give you the DDL of all the objects in the schema
select get_ddl ('schema', 'source', true);
-- THis will copy the DB with the data
create database mytestdb_clone clone mytestdb;
https://docs.snowflake.com/en/sql-reference/sql/create-clone.html
我在一个雪花帐户上有两个数据库。数据库 db1 的架构 sch_a 和 db2 的架构 sch_b。我想从 db1,模式 sch_a 到 db2,sch_b 创建所有表。如何将所有表从一个数据库移动到另一个数据库?我只需要没有数据的表结构,所以空表。提前谢谢你。
您可以使用 GET_DDL 或 CREATE … CLONE
-- THis will give you the DDL of all the objects in the schema
select get_ddl ('schema', 'source', true);
-- THis will copy the DB with the data
create database mytestdb_clone clone mytestdb;
https://docs.snowflake.com/en/sql-reference/sql/create-clone.html