All Products
Search
Document Center

Realtime Compute for Apache Flink:Hologres YAML connector for data ingestion

Last Updated:Apr 30, 2026

This topic describes how to use the Hologres connector to synchronize data in a YAML data ingestion deployment.

Background

Hologres is a real-time data warehouse engine that supports real-time writes, updates, and analytics at scale. Hologres is compatible with the PostgreSQL protocol and supports standard SQL. It supports online analytical processing (OLAP) and ad hoc queries on petabytes of data, and serves data with high concurrency and low latency. Hologres integrates with MaxCompute, Realtime Compute for Apache Flink, and DataWorks to offer a complete online and offline data warehouse solution. The following table describes the capabilities of the Hologres YAML connector.

Item

Description

Table type

Sink

Running mode

Streaming and batch modes

Data format

N/A

Metric

  • numRecordsOut

  • numRecordsOutPerSecond

Note

For more details, see Metrics.

API type

YAML

Updates or deletions in a sink table

Supported

Features

Feature

Description

Full database synchronization

Synchronizes full and incremental data in real time from an entire database or multiple tables to corresponding sink tables.

Schema change synchronization

Synchronizes schema changes (such as adding, dropping, or renaming columns) from source tables to corresponding sink tables in real time.

Sharded database and table synchronization

Use a regular expression to match source tables across multiple sharded databases by name. Data from these tables is then merged and synchronized to correspondingly named downstream sink tables.

Writing to a partitioned table

Writes data from an upstream table to a Hologres partitioned table.

Data type mapping

Maps upstream data types to broader Hologres data types using multiple strategies.

Syntax

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}

Parameters

Parameter

Description

Type

Required

Default

Remarks

type

The sink type.

String

Yes

None

The value must be hologres.

name

The sink name.

String

No

None

N/A.

dbname

The database name.

String

Yes

None

N/A.

username

The username for database access. Use the AccessKey ID of your Alibaba Cloud account.

String

Yes

None

For more information, see How do I view the AccessKey ID and AccessKey secret?

Important

To avoid exposing your AccessKey, specify its values by using variables. For more information, see Project variables.

password

The password for database access. Use the AccessKey Secret of your Alibaba Cloud account.

String

Yes

None

endpoint

The Hologres service endpoint.

String

Yes

None

For more information, see Access endpoints.

jdbcRetryCount

The number of retries for write and query operations when a connection fails.

Integer

No

10

N/A.

jdbcRetrySleepInitMs

The fixed wait time for each retry attempt.

Long

No

1000

Unit: milliseconds. The actual wait time for a retry is calculated by using the following formula: jdbcRetrySleepInitMs + retry * jdbcRetrySleepStepMs.

jdbcRetrySleepStepMs

The incremental wait time for each retry attempt.

Long

No

5000

Unit: milliseconds. The actual wait time for a retry is calculated by using the following formula: jdbcRetrySleepInitMs + retry * jdbcRetrySleepStepMs.

jdbcConnectionMaxIdleMs

The maximum idle time for a JDBC connection.

Long

No

60000

Unit: milliseconds. If a connection is idle for longer than this duration, it is disconnected and released.

jdbcMetaCacheTTL

The expiration time for locally cached TableSchema information.

Long

No

60000

Unit: milliseconds.

jdbcMetaAutoRefreshFactor

A factor that determines the cache refresh trigger. The system automatically refreshes the cache if its remaining lifetime is less than the trigger time.

Integer

No

4

The remaining cache lifetime is calculated as follows: Remaining cache lifetime = Cache expiration time - Time the cache has been active. After an automatic refresh, the cache's active time is reset to 0.

The trigger time is calculated by using the formula: jdbcMetaCacheTTL / jdbcMetaAutoRefreshFactor.

mutatetype

The data writing mode.

String

No

INSERT_OR_UPDATE

If a primary key is set for the Hologres physical table, the Hologres sink ensures exactly-once semantics based on the primary key. If data with a duplicate primary key arrives, the mutatetype parameter determines how the sink table is updated. The mutatetype parameter supports the following values:

  • INSERT_OR_IGNORE: Retains the first occurrence of data and ignores all subsequent data.

  • INSERT_OR_REPLACE: New data replaces the entire existing row.

  • INSERT_OR_UPDATE: Updates a subset of columns for an existing row. For example, a table has four columns: a, b, c, and d, and a is the Primary Key (PK). If you write data for only columns a and b to Hologres and a row with the same PK already exists, the system updates only column b. Columns c and d remain unchanged.

createparttable

Specifies whether to automatically create non-existent partitions when writing to a partitioned table.

Boolean

No

false

N/A.

sink.delete-strategy

Specifies how to process retraction messages.

String

No

None

Valid values:

  • IGNORE_DELETE: Ignores Update Before and Delete messages. This value is suitable for scenarios where you only need to insert or update data, but not delete it.

  • DELETE_ROW_ON_PK: The Flink framework applies the delete operation based on the primary key. For update operations, it first deletes the old data and then inserts the new data to ensure data accuracy.

jdbcWriteBatchSize

In JDBC mode, the maximum number of records to buffer in the Hologres sink before a batch write.

Integer

No

256

Unit: rows.

Note

The jdbcWriteBatchSize, jdbcWriteBatchByteSize, and jdbcWriteFlushInterval parameters have an OR relationship. If you set all three parameters, the result data is written as soon as one of the conditions is met.

jdbcWriteBatchByteSize

In JDBC mode, this parameter specifies the maximum size of data in bytes that the Hologres sink buffers before writing the batch to the destination.

Long

No

2,097,152 bytes (2 MB)

Note

The jdbcWriteBatchSize, jdbcWriteBatchByteSize, and jdbcWriteFlushInterval parameters have an OR relationship. If you set all three parameters, the result data is written as soon as one of the conditions is met.

jdbcWriteFlushInterval

In JDBC mode, this parameter specifies the maximum amount of time the Hologres sink waits before writing buffered data to Hologres.

Long

No

10000

Unit: milliseconds.

Note

The jdbcWriteBatchSize, jdbcWriteBatchByteSize, and jdbcWriteFlushInterval parameters have an OR relationship. If you set all three parameters, the result data is written as soon as the condition for any one of them is met.

ignoreNullWhenUpdate

Specifies whether to ignore null values in the incoming data when mutatetype is set to INSERT_OR_UPDATE.

Boolean

No

false

Valid values:

  • false (default): Writes null values to the Hologres sink table.

  • true: Ignores null values in the incoming data.

jdbcEnableDefaultForNotNullColumn

Specifies whether to insert a default value when a null is written to a NOT NULL column that lacks a defined default value.

Boolean

No

true

Valid values:

  • true (default): Allows the connector to insert a default value. The rules are as follows:

    • For a String type column, an empty string ("") is written.

    • For a Number type column, 0 is written.

    • For Date, timestamp, or timestamptz type columns, 1970-01-01 00:00:00 is written.

  • false: Does not insert a default value. An exception is thrown when a null value is written to a NOT NULL column.

remove-u0000-in-text.enabled

Specifies whether to remove the null character (\u0000) from strings before writing.

Boolean

No

false

Valid values:

  • false (default): The connector does not process the data. However, if dirty data is encountered, a write operation may throw the following exception: ERROR: invalid byte sequence for encoding "UTF8": 0x00

    In this case, you must either process the dirty data in the source table or define data handling logic in your SQL statement.

  • true: The connector removes the \u0000 character from strings to prevent write exceptions.

deduplication.enabled

Specifies whether to perform deduplication within each batch before writing in jdbc and jdbc_fixed modes.

Boolean

No

true

Valid values:

  • true (default): Enables deduplication within a batch. If multiple records have the same primary key, only the last one is retained. For example, consider data with two fields, where the first field is the primary key:

    • Records INSERT (1,'a') and INSERT (1,'b') arrive sequentially. After deduplication, only the later record (1,'b') is written to the Hologres sink table.

    • The Hologres sink table already contains the record (1,'a'). If the DELETE (1,'a') and INSERT (1,'b') records arrive sequentially, only the last-arriving record (1,'b') is written to Hologres. This is treated as a direct update, not a delete followed by an insert.

  • false: No deduplication is performed during batching. If a new record has the same primary key as a record already in the current batch, the current batch is written first. After the write is complete, the new record is then processed.

sink.type-normalize-strategy

The data type mapping strategy.

String

No

STANDARD

The strategy that the Hologres sink uses to convert upstream data types to Hologres types.

  • STANDARD: Converts Flink CDC types to standard PostgreSQL (PG) types.

  • BROADEN: Converts Flink CDC types to wider-range Hologres types.

  • ONLY_BIGINT_OR_TEXT: Converts all Flink CDC types to either BIGINT or TEXT in Hologres.

sink.insert.legacy-put-handler

Specifies whether to use the legacy Put Handler to write data to Hologres.

Boolean

No

false

Valid values:

  • false (default): The new Put Handler is used to write data. The SQL format for the write operation is insert into xxx(c0,c1,...) select unnest(?),unnest(?),... on conflict.

  • true: Writes data by using the legacy Put Handler. The SQL format for writing is insert into xxx(c0,c1,...) values (?,?,...),... on conflict; .

table_property.*

The physical table properties for Hologres.

String

No

None

When you create a Hologres table, you can set physical table properties in the WITH clause. Appropriate table properties can help the system organize and query data efficiently.

Warning

The table_property.distribution_key parameter defaults to the primary key value. Do not change this setting unless you fully understand the impact, as it can affect the correctness of data writes.

connection.ssl.mode

Specifies whether to enable Secure Sockets Layer (SSL) transport encryption and which mode to use.

String

No

disable

  • disable (default): Disables transport encryption.

  • require: Enables SSL to encrypt the data link.

  • verify-ca: Enables SSL, encrypts the data link, and uses a CA certificate to verify the authenticity of the Hologres server.

  • verify-full: Enables SSL, encrypts the data link, uses a CA certificate to verify the authenticity of the Hologres server, and verifies that the CN or DNS name in the certificate matches the configured Hologres endpoint.

Note
  • Hologres V2.1 and later support the verify-ca and verify-full modes. For more information, see Transport encryption.

  • If you set this parameter to verify-ca or verify-full, you must also configure the connection.ssl.root-cert.location parameter.

connection.ssl.root-cert.location

When the transport encryption mode requires a certificate, specifies the path to the certificate file.

String

No

None

When connection.ssl.mode is set to verify-ca or verify-full, you must also configure the path to the CA certificate. You can upload the certificate to the platform by using the File Management feature in the Realtime Compute console. After the certificate is uploaded, it is stored in the /flink/usrlib directory. For example, if the CA certificate file is named certificate.crt, the parameter value must be '/flink/usrlib/certificate.crt'.

Note

To obtain a CA certificate, see Transport encryption - Download a CA certificate.

connection.akv4.enabled

Specifies whether to enable AKV4 mode to connect to the Hologres server.

Boolean

No

false

N/A.

connection.akv4.region

When AKV4 mode is enabled, specifies the region where the server is located.

String

No

None

For example, cn-shanghai.

Reuse an existing Catalog

Starting from VVR 11.5, you can directly reference a built-in Hologres Catalog created on the Data Management page in a Flink CDC data ingestion job. This reduces the need to manually specify connection properties.

sink:
  type: hologres
  using.built-in-catalog: my_holo_catalog

Data ingestion jobs can automatically reuse the following Hologres Catalog parameters:

  • endpoint

  • username

  • password

  • dbname

To override these automatically reused parameters, you can explicitly specify the corresponding YAML parameters, which have a higher priority.

Data type mapping

You can use the parameter sink.type-normalize-strategy to set the strategy for converting upstream data to Hologres types.

Note
  • Enable sink.type-normalize-strategy when you start a YAML job for the first time. If you enable it after the job has started, you must delete the downstream table and restart the job without state for the setting to take effect.

  • Currently, array types support only INTEGER, BIGINT, FLOAT, DOUBLE, BOOLEAN, CHAR, and VARCHAR.

  • Hologres does not support the numeric type as a primary key. If a primary key's type maps to numeric, the system converts it to the varchar type.

STANDARD

When sink.type-normalize-strategy is set to STANDARD, the types are mapped as follows:

Flink CDC type

Hologres type

CHAR

bpchar

STRING

text

VARCHAR

text (if length > 10485760)

varchar (if length <= 10485760)

BOOLEAN

bool

BINARY

bytea

VARBINARY

DECIMAL

numeric

TINYINT

int2

SMALLINT

INTEGER

int4

BIGINT

int8

FLOAT

float4

DOUBLE

float8

DATE

date

TIME_WITHOUT_TIME_ZONE

time

TIMESTAMP_WITHOUT_TIME_ZONE

timestamp

TIMESTAMP_WITH_LOCAL_TIME_ZONE

timestamptz

ARRAY

Arrays of the corresponding element types

MAP

Not supported

ROW

Not supported

BROADEN

When sink.type-normalize-strategy is set to BROADEN, Flink CDC types are converted to wider-range Hologres types. The types are mapped as follows:

Flink CDC type

Hologres type

CHAR

text

STRING

VARCHAR

BOOLEAN

bool

BINARY

bytea

VARBINARY

DECIMAL

numeric

TINYINT

int8

SMALLINT

INTEGER

BIGINT

FLOAT

float8

DOUBLE

DATE

date

TIME_WITHOUT_TIME_ZONE

time

TIMESTAMP_WITHOUT_TIME_ZONE

timestamp

TIMESTAMP_WITH_LOCAL_TIME_ZONE

timestamptz

ARRAY

Arrays of the corresponding element types

MAP

Not supported

ROW

Not supported

ONLY_BIGINT_OR_TEXT

When sink.type-normalize-strategy is set to ONLY_BIGINT_OR_TEXT, all Flink CDC types are converted to BIGINT or STRING types in Hologres. The data type mapping is as follows:

Flink CDC type

Hologres type

TINYINT

int8

SMALLINT

INTEGER

BIGINT

BOOLEAN

text

BINARY

VARBINARY

DECIMAL

FLOAT

DOUBLE

DATE

TIME_WITHOUT_TIME_ZONE

TIMESTAMP_WITHOUT_TIME_ZONE

TIMESTAMP_WITH_LOCAL_TIME_ZONE

ARRAY

Arrays of the corresponding element types

MAP

Not supported

ROW

Not supported

Writing to partitioned tables

You can use the Hologres sink with a transform to write upstream data to a Hologres partitioned table.

  • The partition key must be part of the primary key. If you use a non-primary key column from the upstream data as the partition key, the primary keys of the upstream and downstream tables can become inconsistent, causing data discrepancies during data synchronization.

  • Hologres supports columns of the TEXT, VARCHAR, and INT data types as a partition key. Since version 1.3.22, columns of the DATE data type are also supported.

  • To automatically create child partitioned tables, set the createparttable parameter to true. Otherwise, you must create them manually.

See Writing data to a partitioned table for an example.

Table schema synchronization

A CDC YAML pipeline uses different strategies to handle table schema changes, which are configurable with the pipeline-level schema.change.behavior parameter. Valid values for schema.change.behavior are IGNORE, LENIENT, TRY_EVOLVE, EVOLVE, and EXCEPTION. Hologres Sink does not currently support the TRY_EVOLVE strategy. The LENIENT and EVOLVE strategies involve table schema changes. The following sections describe how these two modes handle different schema change events.

LENIENT (default)

In LENIENT mode, schema changes are handled as follows:

  • Add a nullable column: The corresponding column is automatically added to the end of the sink table, and its data is synchronized.

  • Delete a nullable column: The column is not deleted from the sink table. Instead, the column is automatically populated with NULL values.

  • Add a non-nullable column: A corresponding nullable column is automatically added to the end of the sink table, and its data is synchronized. For existing rows, this new column is automatically populated with NULL.

  • Rename a column: This operation is treated as deleting a column and adding a new one. A new column with the specified name is added to the end of the sink table, and the column with the original name is automatically populated with NULL values. For example, if col_a is renamed to col_b, a col_b column is added to the end of the sink table, and the col_a column is automatically populated with NULL values.

  • Change a column's data type: Not supported. As Hologres does not support changing a column's data type, you must use the sink.type-normalize-strategy parameter.

  • The following schema changes are not supported:

    • Changes to constraints, such as the primary key or index.

    • Deleting a non-nullable column.

    • Changing a column from NOT NULL to NULLABLE.

EVOLVE

In EVOLVE mode, schema changes are handled as follows:

  • Add a nullable column: Supported.

  • Delete a nullable column: Not supported.

  • Add a non-nullable column: A new nullable column is added to the sink table.

  • Rename a column: Supported. The original column is renamed in the sink table.

  • Change a column's data type: Not supported. As Hologres does not support changing a column's data type, you must use the sink.type-normalize-strategy parameter.

  • The following schema changes are not supported:

    • Changes to constraints, such as the primary key or index.

    • Deleting a non-nullable column.

    • Changing a column from NOT NULL to NULLABLE.

Warning

In EVOLVE mode, performing a stateless restart without deleting the sink table can cause the pipeline to fail due to schema inconsistencies between the upstream data and the sink table. You must then manually adjust the sink table schema.

See Enabling the EVOLVE mode for an example.

Code examples

Type broadening

Use the sink.type-normalize-strategy parameter to configure type broadening.

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

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}
  # Map CDC data types to broader Hologres types.
  sink.type-normalize-strategy: BROADEN

pipeline:
  name: MySQL to Hologres Pipeline

Writing to a partitioned table

Convert the create_time timestamp field to a date type and use it as the partition key for the Hologres 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

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}
  # Automatically create partitioned tables if they do not exist.
  createparttable: 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 Hologres Pipeline

Enabling EVOLVE mode

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

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}
  # Automatically create partitioned tables if they do not exist.
  createparttable: true

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

Single-table synchronization

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

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}
  # Map CDC data types to broader Hologres types.
  sink.type-normalize-strategy: BROADEN

pipeline:
  name: MySQL to Hologres Pipeline

Full database synchronization

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.\.*
  server-id: 5401-5499

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}
  # Map CDC data types to broader Hologres types.
  sink.type-normalize-strategy: BROADEN

pipeline:
  name: MySQL to Hologres Pipeline

Merging sharded tables

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.user\.*
  server-id: 5401-5499

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}
  # Map CDC data types to broader Hologres types.  
  sink.type-normalize-strategy: BROADEN
  
route:
  # All sharded tables in the MySQL test_db database are merged into a single Hologres table named test_db.user.
  - source-table: test_db.user\.*
    sink-table: test_db.user

pipeline:
  name: MySQL to Hologres Pipeline

Synchronizing to a specified schema

In Hologres, a schema corresponds to a database in MySQL. You can specify the schema for the sink tables.

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.user\.*
  server-id: 5401-5499

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}
  # Map CDC data types to broader Hologres types.
  sink.type-normalize-strategy: BROADEN
  
route:
  # Synchronize all tables from the MySQL test_db database to the Hologres test_db2 schema while keeping the original table names.
  - source-table: test_db.\.*
    sink-table: test_db2.<>
    replace-symbol: <>

pipeline:
  name: MySQL to Hologres Pipeline

Synchronizing new tables without restart

To synchronize newly added tables in real time while a job is running, set scan.binlog.newly-added-table.enable = true.

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.\.*
  server-id: 5401-5499
  # Automatically captures new tables created while the job is running.  
  scan.binlog.newly-added-table.enabled: true

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}
  # Map CDC data types to broader Hologres types.
  sink.type-normalize-strategy: BROADEN

pipeline:
  name: MySQL to Hologres Pipeline

Adding existing tables on restart

To include an existing table in the synchronization, set scan.newly-added-table.enabled to true and restart the job.

Warning

Do not use scan.newly-added-table.enabled on a job that was previously run with scan.binlog.newly-added-table.enabled. This combination causes data duplication on restart.

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 restart, the job scans for new tables matching the `tables` parameter and performs a snapshot.
  # Note: This parameter must be used with scan.startup.mode: initial.
  scan.newly-added-table.enabled: true

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}
  # Map CDC data types to broader Hologres types.
  sink.type-normalize-strategy: BROADEN

pipeline:
  name: MySQL to Hologres Pipeline

Excluding tables

source:
  type: mysql
  name: MySQL Source
  hostname: <yourHostname>
  port: 3306
  username: flink
  password: ${secret_values.password}
  tables: test_db.\.*
  # Excludes tables that match this regular expression.
  tables.exclude: test_db.table1
  server-id: 5401-5499

sink:
  type: hologres
  name: Hologres Sink
  endpoint: <yourEndpoint>
  dbname: <yourDbname>
  username: ${secret_values.ak_id}
  password: ${secret_values.ak_secret}
  # Map CDC data types to broader Hologres types.
  sink.type-normalize-strategy: BROADEN

pipeline:
  name: MySQL to Hologres Pipeline

Related documents