REPLACE TABLE AS SELECT

最近更新时间:2023-03-08 16:30:39

我的收藏

说明

支持内核:SparkSQL。
适用表类型:外部 Iceberg 表、原生 Iceberg 表。
用途:保留表 history 情况下,从目标表更新替换表快照 snapshot。

语法

CREATE [OR REPLACE] TABLE table_identifier
USING iceberg
[ COMMENT table_comment ]
[ PARTITIONED BY ( col_name1, transform(col_name2), ... ) ]
[ LOCATION path ]
[ TBLPROPERTIES ( property_name=property_value, ... ) ]
AS select_statement

示例

CREATE OR REPLACE TABLE dempts_replace
USING iceberg
COMMENT 'table create as replace'
PARTITIONED BY (eno, dno)
TBLPROPERTIES ('write.format.default'='avro')
LOCATION '/warehouse/db_001/dempts_replace'
AS SELECT * from dempts;