Paimon YAML connector

Updated at:

This topic describes how to use the Paimon 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 Paimon in advance. A data ingestion job automatically creates the Paimon table based on the upstream schema. If the destination table already exists, the job checks the compatibility of the existing schema and automatically adapts to it.

  • Schema change synchronization

    Use the pipeline-level configuration item schema.change.behavior to control the schema change policy and apply upstream schema changes to Paimon tables in real time. For more information, see Schema Changes.

  • Entire-database synchronization and sharded table merging

    Supports synchronizing a single table, synchronizing an entire database, replacing database and table names during entire-database synchronization, merging sharded databases and tables, and excluding specific tables in entire-database synchronization. For more information, see Examples.

  • Reuse of an existing catalog

    Since VVR 11.5, you can directly reference a built-in Paimon 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, Paimon can be used only as a sink and cannot be used as a source.

  • The following table lists the version compatibility between Paimon and VVR.

    Apache Paimon version

    VVR

    2.0.0

    11.9

    1.3.1

    11.5, 11.6, 11.7, 11.8

    1.3

    11.4

    1.2

    11.2, 11.3

    1.1

    11.1

    1.0

    8.0.11

  • Some configuration items require specific VVR versions. For more information, see the Remarks column in the Parameters table.

Usage notes

  • Storage recommendations for concurrent writes

    When multiple jobs perform concurrent writes to the same Paimon table, using standard OSS storage (oss://) can occasionally cause commit conflicts or job failures due to limitations on atomic file operations.

    For stable and consistent writes, use a metadata or storage service that provides strong atomic guarantees. The preferred option is Data Lake Formation (DLF), which offers unified management of Paimon metadata and storage. Alternatively, you can use OSS-HDFS or HDFS.

  • How configuration changes take effect

    Changes to the configuration parameters of a Paimon table take effect only after you restart the related jobs. Running jobs do not dynamically load these changes.

Data ingestion

You can use the Paimon connector as a sink in data ingestion YAML jobs.

Syntax

sink:
  type: paimon
  name: Paimon Sink
  catalog.properties.metastore: filesystem
  catalog.properties.warehouse: /path/warehouse

Parameters

Parameter

Description

Required

Type

Default

Notes

type

The connector type.

Yes

STRING

None

The value must be paimon.

name

The name of the sink.

No

STRING

None

catalog.properties.metastore

The type of the Paimon catalog.

No

STRING

filesystem

Valid values:

  • filesystem (default)

  • rest (supports only Data Lake Formation (DLF), not DLF-Legacy)

catalog.properties.*

Parameters for creating a Paimon catalog.

No

STRING

None

For more information, see Manage Paimon Catalog.

table.properties.*

Parameters for creating a Paimon table.

No

STRING

None

For more information, see Paimon table options.

table.properties.file.format

The storage format of data files in the table.

String

No

parquet

Valid values:

  • orc

  • parquet

  • avro

  • lance (VVR 11.6 and later)

  • mosaic (VVR 11.9 and later)

catalog.properties.warehouse

The root directory for file storage.

No

STRING

None

This parameter applies only when catalog.properties.metastore is set to filesystem.

commit.user-prefix

The username prefix for committing data files.

No

STRING

None

Note

We recommend setting different usernames for different jobs. This makes it easier to identify the job that causes a commit conflict.

partition.key

The partition keys for a partitioned table.

No

STRING

None

Different tables are separated by ;, different fields are separated by ,, and tables and fields are separated by :. For example: testdb.table1:id1,id2;testdb.table2:name.

sink.cross-partition-upsert.tables

Lists tables that require a cross-partition upsert, where the primary key does not include all partition keys.

No

STRING

None

Applies to tables with cross-partition updates.

  • Format: Use a semicolon ; to separate table names.

  • Performance recommendation: This operation is resource-intensive. Create separate jobs for these tables.

Important
  • You must list all tables that meet the criteria. Omitting a table name will result in data duplication.

sink.commit.parallelism

Specifies the parallelism of the Commit operator.

No

INTEGER

None

If the Commit operator is a bottleneck, use this parameter to increase its parallelism and improve performance.

This parameter is supported only in Realtime Compute for Apache Flink 11.6 and later.

Note

Setting this parameter changes the operator parallelism. When restarting a stateful job, you must specify AllowNonRestoredState so the job can ignore partial operator state.

sink.existing-table.schema-check.enabled

Specifies whether to check the compatibility of the existing table schema and automatically adapt the schema when data is written to a pre-created table.

Boolean

No

true

The following list describes the valid values and the behavior when data is written to a pre-created table:

  • true (default): checks the compatibility of column types and of missing or redundant NOT NULL columns in the existing table, and automatically adds the nullable columns that exist in the upstream table but are missing in the downstream table. If a case cannot be automatically adapted, the job fails and returns the SQL statements that you can run to fix the issue.

  • false: skips the preceding check and automatic column addition, and writes data based on the existing schema of the downstream table. Only the automatic column addition that is performed when the initial CREATE TABLE statement is executed is skipped. Subsequent schema changes are automatically applied.

Note

This parameter is supported only in Realtime Compute for Apache Flink VVR 11.8 and later.

branch

The branch to which data is written.

Yes

STRING

main

Note

This parameter is supported only in Realtime Compute for Apache Flink VVR 11.9 and later.

Reuse an existing catalog

Starting with Realtime Compute for Apache Flink 11.5, you can directly reference a built-in Paimon catalog from the Data Management page in a Flink CDC data ingestion job. This reduces manual configuration.

sink:
  type: paimon
  using.built-in-catalog: paimon_dlf_catalog
  catalog.properties.fs.oss.endpoint: oss-cn-beijing-internal.aliyuncs.com

Data ingestion jobs can automatically reuse all parameters in a Paimon catalog. This is equivalent to manually configuring parameters prefixed with catalog.properties. in a YAML job.

To override an automatically reused parameter, explicitly set it in the YAML job. The explicit YAML configuration has a higher priority. For example, in the preceding sample, the fs.oss.endpoint parameter uses the value from the YAML job, overriding the one in paimon_dlf_catalog.

Schema Changes

A CDC YAML pipeline job can use different strategies to handle schema changes. To configure the strategy, set the pipeline-level parameter schema.change.behavior as described in Schema evolution configurations. schema.change.behavior can be set to IGNORE, LENIENT, TRY_EVOLVE, EVOLVE, or EXCEPTION. The following sections describe how the LENIENT and EVOLVE modes, which involve schema changes, handle different schema change events.

LENIENT (default)

The following schema changes are supported in LENIENT mode:

  • Add a nullable column: the column is automatically appended to the schema of the result table, and data of the new column is automatically synchronized.

  • Drop a nullable column: the column is not dropped from the result table. Instead, the data of the column is automatically replaced with NULL values.

  • Add a NOT NULL column: the column is automatically appended to the schema of the result table, and data of the new column is automatically synchronized. The new column is nullable by default, and the data generated before the column is added is set to NULL.

  • Rename a column: the operation is treated as adding a column and dropping a column. The renamed column is appended to the end of the result table, and the data of the original column is automatically replaced with NULL values. For example, if col_a is renamed as col_b, col_b is appended to the end of the result table, and the data of col_a is replaced with NULL values.

  • Change a column type: changes the data type of the corresponding column in the result table.

  • The following schema changes are not supported:

    • Changes to primary key types.

    • Changes from NULLABLE to NOT NULL.

EVOLVE

The following schema changes are supported in EVOLVE mode:

  • Add a nullable column: supported.

  • Drop a nullable column: not supported.

  • Add a NOT NULL column: a nullable column is added to the result table.

  • Rename a column: supported. The original column is renamed in the result table.

  • Change a column type: changes the data type of the corresponding column in the result table.

  • The following schema changes are not supported:

    • Changes to primary key types.

    • Changes from NULLABLE to NOT NULL.

For an example of how to enable the EVOLVE mode, see Enable EVOLVE mode.

Note

If the downstream Paimon table already exists, the job writes data to the existing table schema and does not attempt to create the table again. If the existing table schema differs from the schema of the upstream table, the nullable columns that exist in the upstream table but are missing in the downstream table are automatically added to the existing table. If a case cannot be automatically adapted, such as an incompatible column type or a missing or redundant NOT NULL column, the check fails and an error is reported. You can run the SQL statements that are recommended in the error message to modify the table schema. You can also set sink.existing-table.schema-check.enabled to false in the sink to skip the check and automatic column addition, so that data is written based on the schema of the downstream table.

Examples

The following examples show configurations in typical scenarios.

Write to a Rest Catalog

The following example shows how to write data to Data Lake Formation (DLF) when the Paimon catalog is of the rest type:

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
  #(Optional) Synchronize data from newly added tables during the incremental phase.
  scan.binlog.newly-added-table.enabled: true
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true

sink:
  type: paimon
  name: Paimon Sink
  catalog.properties.metastore: rest
  catalog.properties.uri: dlf_uri
  catalog.properties.warehouse: your_warehouse
  catalog.properties.token.provider: dlf
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true

For information about the parameters prefixed with catalog.properties, see Flink CDC Catalog configuration parameters.

Write to a FileSystem Catalog

Example configuration for writing to Object Storage Service (OSS) with a filesystem Paimon catalog:

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
  #(Optional) Synchronize data from newly added tables during the incremental phase.
  scan.binlog.newly-added-table.enabled: true
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true

sink:
  type: paimon
  name: Paimon Sink
  catalog.properties.metastore: filesystem
  catalog.properties.warehouse: oss://default/test
  catalog.properties.fs.oss.endpoint: oss-cn-beijing-internal.aliyuncs.com
  catalog.properties.fs.oss.accessKeyId: xxxxxxxx
  catalog.properties.fs.oss.accessKeySecret: xxxxxxxx
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true

For information about the parameters prefixed with catalog.properties, see Create a Paimon Filesystem Catalog.

Write to a partitioned table

Converts the create_time field of the TIMESTAMP type in the upstream table into a DATE field, which is used as the partition key of the Paimon table.

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.test_source_table
  server-id: 5401-5499
  #(Optional) Synchronize data from newly added tables during the incremental phase.
  scan.binlog.newly-added-table.enabled: true
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true

sink:
  type: paimon
  name: Paimon Sink
  using.built-in-catalog: paimon_dlf_catalog
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true
 
transform:
  - source-table: test_db.test_source_table
    projection: \*, DATE_FORMAT(CAST(create_time AS TIMESTAMP), 'yyyy-MM-dd') as partition_key
    primary-keys: id, create_time, partition_key
    partition-keys: partition_key
    description: add partition key 

pipeline:
  name: MySQL to Paimon Pipeline

Synchronize a single table

We recommend that you configure single-table synchronization jobs for tables that have high requirements for real-time performance and stability. Single-table synchronization avoids the complexity of multi-table synchronization. The following example shows the configuration:

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.test_source_table
  server-id: 5401-5499
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true


sink:
  type: paimon
  name: Paimon Sink
  using.built-in-catalog: paimon_dlf_catalog
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true

pipeline:
  name: MySQL to Paimon Pipeline

Synchronize an entire database

Synchronizing an entire database reduces the number of jobs that you need to configure and run, which lowers O&M costs. The following example shows the configuration:

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.\.*
  server-id: 5401-5499
  #(Optional) Synchronize data from newly added tables during the incremental phase.
  scan.binlog.newly-added-table.enabled: true
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true


sink:
  type: paimon
  name: Paimon Sink
  using.built-in-catalog: paimon_dlf_catalog
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true

pipeline:
  name: MySQL to Paimon Pipeline

Synchronize an entire database and replace database and table names

To replace database and table names in a batch, add the route section to an entire-database synchronization job. The following example shows the configuration:

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.\.*
  server-id: 5401-5499
  #(Optional) Synchronize data from newly added tables during the incremental phase.
  scan.binlog.newly-added-table.enabled: true
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true


sink:
  type: paimon
  name: Paimon Sink
  using.built-in-catalog: paimon_dlf_catalog
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true
  
route:
  # Synchronize all tables in the MySQL test_db database to the Paimon test_db2 database and retain the table names.
  - source-table: test_db.\.*
    sink-table: test_db2.<>
    replace-symbol: <>

pipeline:
  name: MySQL to Paimon Pipeline

Merge sharded databases and tables

To write data from multiple sharded tables into a single downstream table, use the following template:

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.user\.*
  server-id: 5401-5499
  #(Optional) Synchronize data from newly added tables during the incremental phase.
  scan.binlog.newly-added-table.enabled: true
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true


sink:
  type: paimon
  name: Paimon Sink
  using.built-in-catalog: paimon_dlf_catalog
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true
  
route:
  # All sharded tables in the MySQL test_db database are merged into a single Paimon test_db.user table.
  - source-table: test_db.user\.*
    sink-table: test_db.user

pipeline:
  name: MySQL to Paimon Pipeline

Add existing tables on job restart

To add existing tables to the synchronization, set scan.newly-added-table.enabled = true and restart the job.

Important

If the job first sets scan.binlog.newly-added-table.enabled to true to capture new tables, do not then set scan.newly-added-table.enabled to true and restart the job to capture existing tables. Otherwise, data is delivered more than once.

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.\.*
  server-id: 5401-5499
  scan.startup.mode: initial
  # On job restart, check the new tables captured by the tables parameter and take a snapshot.
  # Note: Must be used together with scan.startup.mode: initial.
  scan.newly-added-table.enabled: true
  #(Optional) Synchronize data from newly added tables during the incremental phase.
  scan.binlog.newly-added-table.enabled: true
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true


sink:
  type: paimon
  name: Paimon Sink
  using.built-in-catalog: paimon_dlf_catalog
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true

pipeline:
  name: MySQL to Paimon Pipeline

Exclude specific tables in entire-database synchronization

To exclude specific tables, such as test tables or tables that cause repeated job failovers, from an entire-database synchronization job, use the following configuration:

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.\.*
  # Tables that match this regular expression are not synchronized.
  tables.exclude: test_db.table1
  server-id: 5401-5499
  #(Optional) Synchronize data from newly added tables during the incremental phase.
  scan.binlog.newly-added-table.enabled: true
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true

sink:
  type: paimon
  name: Paimon Sink
  using.built-in-catalog: paimon_dlf_catalog
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true

pipeline:
  name: MySQL to Paimon Pipeline

Synchronize an entire database to Paimon tables in the Lance file format

Lance is a data storage format designed for vector and multimodal data. Set the file.format table creation parameter to write data to Paimon tables that use the Lance file format. The following example shows the configuration:

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.\.*
  server-id: 5401-5499
  #(Optional) Synchronize data from newly added tables during the incremental phase.
  scan.binlog.newly-added-table.enabled: true
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true


sink:
  type: paimon
  name: Paimon Sink
  using.built-in-catalog: paimon_dlf_catalog
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true
  # Specify the file format of output files as lance 
  table.properties.file.format: lance
pipeline:
  name: MySQL to Paimon Pipeline

Enable EVOLVE mode

The EVOLVE mode keeps the schema of the downstream table strictly consistent with the schema of the upstream table, including operations such as dropping fields and dropping tables. In this mode, if the downstream cannot apply all schema change events, the job may fail over and cannot recover without intervention. The following example shows the job configuration:

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.test_source_table
  server-id: 5401-5499
  #(Optional) Synchronize data from newly added tables during the incremental phase.
  scan.binlog.newly-added-table.enabled: true
  #(Optional) Synchronize table and field comments.
  include-comments.enabled: true
  #(Optional) Prioritize the distribution of unbounded shards to prevent potential Out Of Memory (OOM) issues on TaskManagers.
  scan.incremental.snapshot.unbounded-chunk-first.enabled: true
  #(Optional) Enable parsing and filtering to accelerate data reads.
  scan.only.deserialize.captured.tables.changelog.enabled: true

sink:
  type: paimon
  name: Paimon Sink
  using.built-in-catalog: paimon_dlf_catalog
  #(Optional) Specify a commit user. We recommend that you use a different commit user for each job to avoid conflicts.
  commit.user: your_job_name
  #(Optional) Enable deletion vectors to improve read performance.
  table.properties.deletion-vectors.enabled: true

pipeline:
  name: MySQL to Paimon Pipeline
  schema.change.behavior: evolve

FAQ