Iceberg YAML connector
This topic describes how to use the Iceberg connector as a sink to synchronize data in YAML-based data ingestion jobs.
Key features
-
Automatic table creation
You do not need to create the destination table in Iceberg in advance. A data ingestion job automatically creates the Iceberg table based on the upstream schema. If the downstream Iceberg table already exists, the existing schema is used for writes and the job does not attempt to create the table again.
-
Schema change synchronization
Upstream events such as creating a table, adding a column, altering a column type, renaming a column, dropping a column, truncating a table, and dropping a table can be synchronized to the downstream Iceberg table. For more information, see Schema changes.
-
Implicit transforms on partition fields
When you use
partition.keyto configure partition fields, you can apply implicit transform functions directly to the fields, such astruncate[10](id),hour(create_time),day(create_time),month(create_time),year(create_time), andbucket[10](create_time). -
Reuse of an existing catalog
Since VVR 11.5, you can directly reference a built-in Iceberg catalog that is created on the Data Management page, which reduces the manual configuration of connection properties. For more information, see Reuse an existing catalog.
Limits
-
In YAML-based data ingestion jobs, Iceberg can be used only as a sink and cannot be used as a source.
-
The sink supports only Iceberg REST Catalogs of Data Lake Formation (DLF).
catalog.properties.typemust be set torest, andcatalog.properties.io-implmust be set toorg.apache.iceberg.rest.DlfFileIO. -
When an ALTER COLUMN TYPE event is applied, the types of primary key columns cannot be changed.
Data ingestion
You can use the Apache Iceberg connector as a sink in a YAML job for data ingestion.
Syntax
sink:
type: iceberg
name: Iceberg Sink
catalog.properties.rest.signing-region: cn-beijing
catalog.properties.uri: http://cn-beijing-vpc.dlf.aliyuncs.com/iceberg
catalog.properties.warehouse: flink_iceberg
catalog.properties.type: rest
catalog.properties.io-impl: org.apache.iceberg.rest.DlfFileIO
Parameters
|
Parameter |
Description |
Required |
Type |
Default |
Remarks |
|
type |
The type of the connector. |
Yes |
STRING |
None |
The fixed value is |
|
name |
The name of the sink. |
No |
STRING |
None |
The name of the sink. |
|
catalog.properties.rest.signing-region |
The region ID of DLF. For more information, see Service endpoints. |
Yes |
STRING |
None |
None |
|
catalog.properties.uri |
The URI used to access the DLF REST catalog. For more information, see Iceberg REST. |
Yes |
STRING |
None |
None |
|
catalog.properties.warehouse |
Name of the DLF Catalog. |
Yes |
STRING |
None |
None |
|
catalog.properties.warehouse |
The root directory for file storage. |
No |
STRING |
None |
None |
|
catalog.properties.type |
The type of the catalog. The value must be rest. |
Yes |
STRING |
rest |
None |
|
catalog.properties.io-impl |
The value must be org.apache.iceberg.rest.DlfFileIO. |
Yes |
STRING |
org.apache.iceberg.rest.DlfFileIO |
None |
|
partition.key |
The partition key for each partitioned table. |
No |
STRING |
None |
You can set partition keys for multiple tables. Separate table definitions with a semicolon ( For partitions that require implicit transformations, add the transformation function directly to the partition field. Example: |
|
table.properties.* |
The parameters for creating an Iceberg table. |
No |
String |
None |
For more information, see Iceberg table options. |
Reuse an existing catalog
Starting with VVR 11.5, you can directly reference a built-in Iceberg catalog that is created on the Data Management page in a Flink CDC data ingestion job. This simplifies your configuration by reducing the number of required connection properties.
sink:
type: iceberg
using.built-in-catalog: iceberg_catalog
Data ingestion jobs can automatically reuse all Iceberg catalog parameters. This is equivalent to manually configuring parameters with the catalog.properties. prefix in your YAML job.
If you want to override the reused parameters, you can explicitly specify the corresponding YAML parameters. These parameters take precedence.
Example
The following example shows how to use a DLF catalog as an Iceberg catalog and write data to Data Lake Formation (DLF):
-
source: type: mysql name: MySQL Source hostname: ${secret_values.mysql.hostname} port: ${mysql.port} username: ${secret_values.mysql.username} password: ${secret_values.mysql.password} tables: ${mysql.source.table} server-id: 8601-8604 sink: type: iceberg name: Iceberg Sink catalog.properties.rest.signing-region: cn-beijing catalog.properties.uri: http://cn-beijing-vpc.dlf.aliyuncs.com/iceberg catalog.properties.warehouse: flink_iceberg catalog.properties.type: rest catalog.properties.io-impl: org.apache.iceberg.rest.DlfFileIOFor information about the parameters that are prefixed with catalog.properties, see Create an Iceberg DLF catalog.
Schema changes
When used as a data ingestion sink, the Apache Iceberg connector supports the following schema changes:
-
CREATE TABLE
-
ADD COLUMN
-
ALTER COLUMN TYPE (Modifying the type of a primary key column is not supported.)
-
RENAME COLUMN
-
DROP COLUMN
-
TRUNCATE TABLE
-
DROP TABLE
If the downstream Iceberg table already exists, the job uses the existing table schema for writes and does not create the table again.