【发布时间】:2021-11-12 12:39:59
【问题描述】:
create table if not exists map_table like position_map_view;
虽然使用它却给了我操作不允许的错误
【问题讨论】:
标签: databricks azure-databricks databricks-sql
create table if not exists map_table like position_map_view;
虽然使用它却给了我操作不允许的错误
【问题讨论】:
标签: databricks azure-databricks databricks-sql
正如documentation所指出的,你需要使用CREATE TABLE AS,只需在SELECT中使用LIMIT 0:
create table map_table as select * from position_map_view limit 0;
【讨论】:
partitioned by。我知道这并不简单,但仍然可以通过编程方式进行操作,例如将 show create table 与一些文本操作结合起来
我没有找到让CREATE TABLE LIKE 工作的简单方法,但我有一个解决方法。在 Databricks 中的 DBR 上,您应该能够使用 SHALLOW CLONE 做类似的事情:
%sql
CREATE OR REPLACE TABLE $new_database.$new_table
SHALLOW CLONE $original_database.$original_table`;
您需要手动替换$templates。
备注:
【讨论】: