The SeaTunnel provides a sink options placeholders feature that allows you to get upstream table metadata through placeholders.
This functionality is essential when you need to dynamically get upstream table metadata (such as multi-table writes).
This document will guide you through the usage of these placeholders and how to leverage them effectively.
SeaTunnel Zeta
Flink
Spark
The placeholders are mainly controlled by the following expressions:
${database_name}
${database_name:default_my_db}
${schema_name}
${schema_name:default_my_schema}
${table_name}
${table_name:default_my_table}
${schema_full_name}
${table_full_name}
${primary_key}
${unique_key}
${field_names}
${comment}
Requires:
TableSinkFactory
APIenv { // ignore... } source { MySQL-CDC { // ignore... } } transform { // ignore... } sink { jdbc { url = "jdbc:mysql://localhost:3306" driver = "com.mysql.cj.jdbc.Driver" user = "root" password = "123456" database = "${database_name}_test" table = "${table_name}_test" primary_keys = ["${primary_key}"] } }
env { // ignore... } source { Oracle-CDC { // ignore... } } transform { // ignore... } sink { jdbc { url = "jdbc:mysql://localhost:3306" driver = "com.mysql.cj.jdbc.Driver" user = "root" password = "123456" database = "${schema_name}_test" table = "${table_name}_test" primary_keys = ["${primary_key}"] } }
We will complete the placeholder replacement before the connector is started, ensuring that the sink options is ready before use. If the variable is not replaced, it may be that the upstream table metadata is missing this option, for example:
mysql
source not contain ${schema_name}
oracle
source not contain ${databse_name}