Reputation: 197
create table if not exists map_table like position_map_view;
While using this it is giving me operation not allowed error
Upvotes: 2
Views: 4301
Reputation: 1062
I didn't find an easy way of getting CREATE TABLE LIKE
to work, but I've got a workaround. On DBR in Databricks you should be able to use SHALLOW CLONE to do something similar:
%sql
CREATE OR REPLACE TABLE $new_database.$new_table
SHALLOW CLONE $original_database.$original_table`;
You'll need to replace $template
s manually.
Notes:
show create table
statement with custom codeUpvotes: 0
Reputation: 87144
As pointed in documentation, you need to use CREATE TABLE AS
, just use LIMIT 0
in SELECT:
create table map_table as select * from position_map_view limit 0;
Upvotes: 4