Use Realtime Compute for Apache Flink to access Iceberg tables in Alibaba Cloud Data Lake Formation (DLF) by registering a DLF catalog in the Flink development console. After the catalog is set up, you can manage Iceberg databases and tables directly using SQL.
Prerequisites
Before you begin, ensure that you have:
-
A Flink workspace running Ververica Runtime (VVR) 11.1 or later
-
A DLF catalog in the same region as your Flink workspace. See Quick start with DLF
Limitations
| Feature | Supported | Notes |
|---|---|---|
| Create Iceberg catalog | Yes | VVR 11.1+ required; only DLF catalogs are supported |
| Create database | Yes | A default database is created automatically; the default database cannot be deleted |
| Create table | Yes | — |
| Alter table schema | Yes | Rename, add/drop columns, modify column order and comment |
| Drop table | Yes | — |
| Drop catalog | Yes | Only removes the catalog record in Flink; does not affect data in DLF |
Create an Iceberg DLF catalog
Creating an Iceberg catalog in Flink registers a mapping to your existing DLF catalog. It does not create or modify data in DLF. All tables created in the DLF catalog via Iceberg REST are Iceberg tables.
-
Log in to the Realtime Compute for Apache Flink console.
-
In the Actions column for your workspace, click Console.
-
In the left navigation menu, go to Development > Scripts and create a new script.
-
In the SQL editor, paste the following statement. In the lower-right corner, click Environment and select a session cluster running VVR 11.2.0 or later. Then run the statement.
CREATE CATALOG `catalog_name` WITH ( 'type' = 'iceberg', 'catalog-type' = 'rest', 'token.provider' = 'dlf', 'uri' = 'http://cn-hangzhou-vpc.dlf.aliyuncs.com/iceberg', 'warehouse' = 'iceberg_test', 'rest.signing-region' = 'cn-hangzhou', 'io-impl' = 'org.apache.iceberg.rest.DlfFileIO' );Replace the values for
uri,warehouse, andrest.signing-regionwith your own. See Iceberg REST endpoint for the list of available URIs by region. The following table describes each option.Option Required Description Example typeYes Set to iceberg.icebergcatalog-typeYes Set to rest.resttoken.providerYes Set to dlf. Configures DLF-based authentication.dlfuriYes The Iceberg REST endpoint for your DLF catalog. The URI varies by region. See Iceberg REST endpoint. http://ap-southeast-1-vpc.dlf.aliyuncs.com/icebergwarehouseYes The name of your DLF catalog. iceberg_testrest.signing-regionYes The region ID where DLF is deployed. cn-hangzhouio-implYes Set to org.apache.iceberg.rest.DlfFileIO.org.apache.iceberg.rest.DlfFileIO
View or delete a catalog
-
On the Realtime Compute for Apache Flink console, click Console in the Actions column for your workspace.
-
Go to the Data Management page and open Catalog List.
-
To view databases and tables in a catalog, click View next to the catalog name.
-
To delete a catalog, click Delete in the Actions column.
ImportantDeleting a catalog only removes its record from Data Management in your Flink project. The underlying Iceberg data files in DLF are not affected. To reuse the tables, register the catalog again.
Alternatively, run the following statement on the Data Query page:
DROP CATALOG <catalog_name>; -
Manage Iceberg databases
Run the following statements on the Data Query page: select the code and click Run.
Create a database
When you create an Iceberg catalog, a database named default is created automatically. To add another database:
-- Replace my-catalog with your catalog name.
USE CATALOG `my-catalog`;
-- Replace my_db with the database name you want to create.
CREATE DATABASE `my_db`;
Delete a database
The default database in a DLF catalog cannot be deleted.
-- Replace my-catalog with your catalog name.
USE CATALOG `my-catalog`;
-- Delete a database only if it is empty.
DROP DATABASE `my_db`;
-- Delete a database and all tables inside it.
DROP DATABASE `my_db` CASCADE;
Manage Iceberg tables
Once an Iceberg catalog is registered, reference its tables in a job without declaring Data Definition Language (DDL). Use the full three-part name <catalog>.<database>.<table>, or first run USE CATALOG and USE <database>, then reference the table by name alone.