Iceberg supports a comprehensive set of DDL operations in Flink for managing catalogs, databases, and tables.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apache/iceberg/llms.txt
Use this file to discover all available pages before exploring further.
CREATE CATALOG
Hive Catalog
This creates an Iceberg catalog namedhive_catalog that loads tables from Hive metastore:
| Property | Required | Description |
|---|---|---|
uri | ✔️ | The Hive metastore’s thrift URI |
clients | The Hive metastore client pool size, default value is 2 | |
warehouse | The Hive warehouse location | |
hive-conf-dir | Path to a directory containing a hive-site.xml configuration file | |
hadoop-conf-dir | Path to a directory containing core-site.xml and hdfs-site.xml |
Hadoop Catalog
Iceberg supports a directory-based catalog in HDFS:| Property | Required | Description |
|---|---|---|
warehouse | ✔️ | The HDFS directory to store metadata files and data files |
USE CATALOG hadoop_catalog to set the current catalog.
REST Catalog
This creates an Iceberg catalog that loads tables from a REST catalog:| Property | Required | Description |
|---|---|---|
uri | ✔️ | The URL to the REST Catalog |
credential | A credential to exchange for a token in the OAuth2 client credentials flow | |
token | A token which will be used to interact with the server |
Custom Catalog
Flink supports loading a custom IcebergCatalog implementation by specifying the catalog-impl property:
Create via YAML Config
Catalogs can be registered insql-client-defaults.yaml before starting the SQL client:
Create via SQL Files
The Flink SQL Client supports the-i startup option to execute an initialization SQL file:
-i <init.sql> option to initialize SQL Client session:
CREATE DATABASE
By default, Iceberg will use thedefault database in Flink. Create a separate database to avoid creating tables under the default database:
CREATE TABLE
Basic Table
PARTITION BY (column1, column2, ...)to configure partitioning (Flink does not yet support hidden partitioning)COMMENT 'table document'to set a table descriptionWITH ('key'='value', ...)to set table configuration which will be stored in Iceberg table properties
Specify Table Location
To specify the table location, useWITH ('location'='fully-qualified-uri'):
PRIMARY KEY
Primary key constraint can be declared for a column or a set of columns, which must be unique and do not contain null. It’s required for UPSERT mode.PARTITIONED BY
To create a partition table, usePARTITIONED BY:
Iceberg supports hidden partitioning but Flink doesn’t support partitioning by a function on columns. There is no way to support hidden partitions in the Flink DDL.
CREATE TABLE LIKE
To create a table with the same schema, partitioning, and table properties as another table, useCREATE TABLE LIKE:
ALTER TABLE
Alter Table Properties
Iceberg only supports altering table properties:Rename Table
DROP TABLE
To delete a table, run:Examples
Complete Table Creation Flow
Alter Table Example
Next Steps
Queries
Learn how to query Iceberg tables
Writes
Write data to Iceberg tables