Help Center/ AI DataLake/ devg/ Iceberg Development Guide/ Iceberg on Aura/ Iceberg on Aura DDL Syntax Description
Updated on 2026-11-06 GMT+08:00

Iceberg on Aura DDL Syntax Description

Creating an Iceberg Table

You can 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 details about the syntax, see 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 this parameter is set to true, you can use write.metadata.previous-versions-max to specify the number of 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

You can use the TRUNCATE TABLE syntax to clear data from a table. For details, see TRUNCATE.

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 details about the syntax, see DROP TABLE.

Example:

1
DROP TABLE iceberg_ext;

Modifying Table Columns

Using the ALTER TABLE command with clauses like ADD COLUMN, RENAME COLUMN TO, ALTER COLUMN, and DROP COLUMNS, you can perform schema evolution tasks such as adding, renaming, updating, reordering, or removing columns in Iceberg tables.

Iceberg assigns each column a unique fieldId. When writing data, this fieldId is embedded in the file's schema. During reads, the metadata maps columns using fieldId, enabling reading post-schema evolution. For non-Iceberg files lacking fieldId, mapping relies on column names. If column names are reused during schema evolution, it may cause type mismatches, read failures, or retrieval of outdated data.

Example:

Create an Iceberg partitioned table.

CREATE TABLE t_iceberg(a int, b array<struct<x:int, y:int>>) partition by (c int) store as iceberg;
  • Adding columns:

    Iceberg tables allow adding one or more columns to a table or nested fields with complex types. You need to specify the column name, type, optional comments, and position. Comments cannot be added when inserting into nested fields with complex types.

    -- Add to a table.
    alter table t_iceberg add column d int, e float comment 'this is e', f array<int> after a, g struct<x:int,y:int> comment 'this is g' before b;
    -- Add to a nested field with complex types. Use element to specify the sub-type of the array.
    alter table t_iceberg add column b.element.z int after x;
  • Renaming columns:

    Iceberg tables allow renaming table columns or nested fields with complex types.

    alter table t_iceberg rename column a to newa;
    alter table t_iceberg rename column b.element.x to newx;
  • Updating columns:

    Iceberg tables allow updating types, comments, and positions for table columns, as well as types and positions for nested fields.

    alter table t_iceberg alter column a type bigint comment 'this is a' after c, c type bigint comment 'this is c' after a, b.element.y type bigint after first;

    Currently, only upgrades from lower-precision to higher-precision types are allowed:

    • Integer types: From SMALLINT to INT or BIGINT, or from INT to BIGINT.
    • Floating-point types: From FLOAT4 to FLOAT8.
    • NUMERIC type: From a lower precision to a higher precision. The scale cannot be updated.
    • String types: Length increases of VARCHAR or CHAR.

      Floating-point storage is imprecise. When upgrading from FLOAT4 to FLOAT8, decimal precision may change, affecting results.

  • Dropping columns:

    Iceberg allows dropping table columns or nested fields within complex types. However, you cannot delete partition columns or remove all columns from a table or all fields from a complex type.

    alter table t_iceberg drop columns (a, b.x);

Modifying Table Properties

You can modify the properties of a table using the SET/UNSET TABLEPROPERTIES capability of the ALTER TABLE syntax.

Example:

1
2
ALTER TABLE iceberg_ext SET TABLEPROPERTIES ('write.metadata.delete-after-commit.enabled' = 'false');
ALTER TABLE iceberg_ext UNSET TABLEPROPERTIES ('write.metadata.delete-after-commit.enabled');