Altering Apache Iceberg Tables
The ALTER command updates an Iceberg table’s schema in a new snapshot.
{{< codeheader "Syntax" >}}
ALTER TABLE [<table_path>.]<table_name>
[ { ALTER | MODIFY | CHANGE } COLUMN ( <source_col_name> <new_col_name>{ data_type } ) ]
| [ ADD COLUMNS ( <column_name> data_type [, <column_name> data_type ... ] )
| [ DROP COLUMN <column_name> ]
| [ [ ADD | DROP ] PARTITION FIELD [ <column_name> | <partition_transform> ] ]
| [ RENAME [ COLUMN ] <old_column_name> [ TO ] <new_column_name> ]
| [ REFRESH METADATA ]
Parameters
{{< sql-section file="data/sql/apache-iceberg-tables.json" data="everythingAlter" >}}
Examples
{{< codeheader "Add a column" >}}
ALTER TABLE myTable ADD COLUMNS (address VARCHAR)
{{< codeheader "Change the data type of a column to BIGINT" >}}
ALTER TABLE myTable ALTER COLUMN id id BIGINT