Managing Iceberg tables - Amazon Athena

Managing Iceberg tables

Athena supports the following table DDL operations for Iceberg tables.

ALTER TABLE RENAME

Renames a table.

Because the table metadata of an Iceberg table is stored in Amazon S3, you can update the database and table name of an Iceberg managed table without affecting underlying table information.

Synopsis

ALTER TABLE [db_name.]table_name RENAME TO [new_db_name.]new_table_name

Example

ALTER TABLE my_db.my_table RENAME TO my_db2.my_table2

ALTER TABLE SET PROPERTIES

Adds properties to an Iceberg table and sets their assigned values.

In accordance with Iceberg specifications, table properties are stored in the Iceberg table metadata file rather than in AWS Glue. Athena does not accept custom table properties. Refer to the Table properties section for allowed key-value pairs. If you would like Athena to support a specific open source table configuration property, send feedback to athena-feedback@amazon.com.

Synopsis

ALTER TABLE [db_name.]table_name SET TBLPROPERTIES ('property_name' = 'property_value' [ , ... ])

Example

ALTER TABLE iceberg_table SET TBLPROPERTIES ( 'format'='parquet', 'write_compression'='snappy', 'optimize_rewrite_delete_file_threshold'='10' )

ALTER TABLE UNSET PROPERTIES

Drops existing properties from an Iceberg table.

Synopsis

ALTER TABLE [db_name.]table_name UNSET TBLPROPERTIES ('property_name' [ , ... ])

Example

ALTER TABLE iceberg_table UNSET TBLPROPERTIES ('write_compression')

DESCRIBE TABLE

Describes table information.

Synopsis

DESCRIBE [FORMATTED] [db_name.]table_name

When the FORMATTED option is specified, the output displays additional information such as table location and properties.

Example

DESCRIBE iceberg_table

DROP TABLE

Drops an Iceberg table.

Warning

Because Iceberg tables are considered managed tables in Athena, dropping an Iceberg table also removes all the data in the table.

Synopsis

DROP TABLE [IF EXISTS] [db_name.]table_name

Example

DROP TABLE iceberg_table

SHOW CREATE TABLE

Displays a CREATE TABLE DDL statement that can be used to recreate the Iceberg table in Athena. If Athena cannot reproduce the table structure (for example, because custom table properties are specified in the table), an UNSUPPORTED error is thrown.

Synopsis

SHOW CREATE TABLE [db_name.]table_name

Example

SHOW CREATE TABLE iceberg_table

SHOW TABLE PROPERTIES

Shows one or more table properties of an Iceberg table. Only Athena-supported table properties are shown.

Synopsis

SHOW TBLPROPERTIES [db_name.]table_name [('property_name')]

Example

SHOW TBLPROPERTIES iceberg_table