Skip to main content
Iceberg supports a comprehensive set of DDL operations in Flink for managing catalogs, databases, and tables.

CREATE CATALOG

Hive Catalog

This creates an Iceberg catalog named hive_catalog that loads tables from Hive metastore:
Properties:

Hadoop Catalog

Iceberg supports a directory-based catalog in HDFS:
Properties: Execute the SQL command USE CATALOG hadoop_catalog to set the current catalog.

REST Catalog

This creates an Iceberg catalog that loads tables from a REST catalog:
Properties:

Custom Catalog

Flink supports loading a custom Iceberg Catalog implementation by specifying the catalog-impl property:

Create via YAML Config

Catalogs can be registered in sql-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:
Using -i <init.sql> option to initialize SQL Client session:

CREATE DATABASE

By default, Iceberg will use the default database in Flink. Create a separate database to avoid creating tables under the default database:

CREATE TABLE

Basic Table

Table create commands support the commonly used Flink create clauses including:
  • PARTITION BY (column1, column2, ...) to configure partitioning (Flink does not yet support hidden partitioning)
  • COMMENT 'table document' to set a table description
  • WITH ('key'='value', ...) to set table configuration which will be stored in Iceberg table properties

Specify Table Location

To specify the table location, use WITH ('location'='fully-qualified-uri'):
Computed columns and watermark definitions are not currently supported.

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, use PARTITIONED 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, use CREATE TABLE LIKE:
For more details, refer to the Flink CREATE TABLE documentation.

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