Help Center/ DataArts Fabric/ Developer Guide/ Querying Data/ SQL on Iceberg/ Creating, Clearing, and Deleting an Iceberg Table
Updated on 2025-08-25 GMT+08:00

Creating, Clearing, and Deleting an Iceberg Table

Iceberg table data is stored on OBS. DataArts Fabric SQL can directly access Iceberg data on OBS.

Creating an Iceberg Table

Create an Iceberg table using the CREATE TABLE syntax. Unlike tables in other formats, there are no special parameters required for creating an Iceberg table—simply specify STORE AS ICEBERG. For detailed syntax, refer to CREATE TABLE.

Example:

1
2
3
4
5
6
7
8
9
CREATE TABLE iceberg_ext(
col1 int,
col2 varchar(20),
...
)PARTITION BY (col3 bigint) 
TABLEPROPERTIES (
'write.metadata.delete-after-commit.enabled'='true',
'write.metadata.previous-versions-max' = '10' 
) STORE AS ICEBERG;

The parameter write.metadata.delete-after-commit.enabled controls whether to delete the metadata files of older versions after committing a transaction, which defaults to false. When set to true, you can set write.metadata.previous-versions-max to determine how many metadata files to retain.

Exercise caution when using these parameters. While deleting metadata files can conserve storage space, ensure that data consistency and availability remain unaffected.

Clearing an Iceberg Table

To clear data from a table, utilize the TRUNCATE TABLE syntax. Refer to TRUNCATE for specific instructions.

Example:

1
TRUNCATE TABLE iceberg_ext;

Deleting an Iceberg Table

Executing the DROP TABLE syntax will remove both the metadata and data associated with an Iceberg table (note that for managed tables, their metadata and data can be restored through the LakeFormation console post-deletion). For detailed syntax, refer to DROP TABLE.

Example:

1
DROP TABLE iceberg_ext;