After you configure an Iceberg catalog, you can use Realtime Compute for Apache Flink to directly access Iceberg tables in Alibaba Cloud Data Lake Formation (DLF). This topic describes how to create, view, and delete Iceberg catalogs, and how to manage Iceberg databases and tables in the development console.
Notes
Only Ververica Runtime (VVR) 11.1 and later support creating and configuring Iceberg catalogs and Iceberg tables.
Only DLF catalogs are supported.
Create an Iceberg DLF Catalog
Create a catalog in DLF. For more information, see Quick start with DLF.
The DLF catalog must be in the same region as the Flink workspace. Otherwise, you cannot associate them in the subsequent steps.
Create an Iceberg catalog in the development console of Realtime Compute for Apache Flink.
NoteThis operation creates a mapping to your DLF catalog. Creating or deleting the catalog in Flink does not affect actual data in DLF.
All tables created in the DLF catalog via Iceberg REST are Iceberg tables.
Log on to Realtime Compute for Apache Flink's Management Console.
In the Actions column of your workspace, click Console.
In the left navigation menu, click .
Create a new script. In the SQL editor, copy and paste the following SQL statement. In the lower-right corner, click Environment, select a session cluster of VVR 11.2.0+, and run the SQL statement to register a DLF catalog via Iceberg REST.
CREATE CATALOG `catalog_name` WITH ( 'type' = 'iceberg', 'catalog-type' = 'rest', 'uri' = 'http://cn-hangzhou-vpc.dlf.aliyuncs.com/iceberg', 'warehouse' = 'iceberg_test', 'rest.signing-region' = 'cn-hangzhou', 'io-impl' = 'org.apache.iceberg.rest.DlfFileIO' );The following table describes the options.
Option
Description
Required
Example
type
The type. Set this to
iceberg.Yes
iceberg
catalog-type
The catalog type. Set this to
rest.Yes
rest
token.provider
The token provider. Set this to dlf.
Yes
dlf
uri
The URI used to access the DLF catalog via Iceberg REST. For more information, see Iceberg REST.
Yes
http://ap-southeast-1-vpc.dlf.aliyuncs.com/iceberg
warehouse
The name of your DLF catalog.
Yes
iceberg_test
rest.signing-region
The region ID of DLF. For more information, see Endpoints.
Yes
ap-southeast-1
io-impl
Set this to
org.apache.iceberg.rest.DlfFileIO.Yes
org.apache.iceberg.rest.DlfFileIO
Manage Iceberg databases
On the Data Query page, enter the following commands in the text editor, select the code, and click Run.
Create a database
After you create an Iceberg catalog, a database named
defaultis automatically created in the catalog.-- Replace my-catalog with the name of your Catalog. USE CATALOG `my-catalog`; -- Replace my_db with a custom database name. CREATE DATABASE `my_db`;Delete a database
ImportantYou cannot delete the default database from a DLF catalog.
-- Replace my-catalog with the name of your Catalog. USE CATALOG `my-catalog`; -- Replace my_db with the name of the database that you want to delete. DROP DATABASE `my_db`; -- Deletes a database only if it contains no tables. DROP DATABASE `my_db` CASCADE; -- Deletes a database and all tables within it.
Manage Iceberg tables
Create a table
Modify the table schema
Delete a table
View or delete an Iceberg Catalog
On the Realtime Compute for Apache Flink console, click Console in the Actions column for the target workspace.
On the Data Management page, you can view or delete the Iceberg Catalog.
On the Catalog List page, you can view the Catalog Name and Type. To view the databases and tables in a catalog, click View.
Delete: On the Catalog List page, find the catalog that you want to delete and click Delete in the Actions column.
NoteDeleting an Iceberg catalog only removes the record from Data Management in the Flink project. It does not affect the data files of the Iceberg tables. After you delete a catalog, you can reuse the Iceberg tables in it by creating the Iceberg catalog again.
Alternatively, you can enter
DROP CATALOG <catalog name>;in the text editor on the Data Query page, select the code, and then click Run.