This is an automated email from the ASF dual-hosted git repository.

shenghang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new c5d39ff1d8 [Improve][Docs] Add multiple table sync examples for MySQL 
Sink connector (#10241)
c5d39ff1d8 is described below

commit c5d39ff1d8cfe12ea4a9bf7e413903155cde520f
Author: David Zollo <[email protected]>
AuthorDate: Mon Dec 29 21:31:44 2025 +0800

    [Improve][Docs] Add multiple table sync examples for MySQL Sink connector 
(#10241)
    
    Co-authored-by: corgy-w <[email protected]>
---
 docs/en/connector-v2/sink/Mysql.md | 90 ++++++++++++++++++++++++++++++++++---
 docs/zh/connector-v2/sink/Mysql.md | 91 +++++++++++++++++++++++++++++++++++---
 2 files changed, 170 insertions(+), 11 deletions(-)

diff --git a/docs/en/connector-v2/sink/Mysql.md 
b/docs/en/connector-v2/sink/Mysql.md
index 1ba9df7e80..009ee00958 100644
--- a/docs/en/connector-v2/sink/Mysql.md
+++ b/docs/en/connector-v2/sink/Mysql.md
@@ -33,6 +33,7 @@ semantics (using XA transaction guarantee).
 
 - [x] [exactly-once](../../concept/connector-v2-features.md)
 - [x] [cdc](../../concept/connector-v2-features.md)
+- [x] [support multiple table write](../../concept/connector-v2-features.md)
 
 > Use `Xa transactions` to ensure `exactly-once`. So only support 
 > `exactly-once` for the database which is
 > support `Xa transactions`. You can set `is_exactly_once=true` to enable it.
@@ -172,14 +173,11 @@ sink {
     jdbc {
         url = 
"jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true"
         driver = "com.mysql.cj.jdbc.Driver"
-    
         max_retries = 0
         username = "root"
         password = "123456"
         query = "insert into test_table(name,age) values(?,?)"
-    
         is_exactly_once = "true"
-    
         xa_data_source_class_name = "com.mysql.cj.jdbc.MysqlXADataSource"
     }
 }
@@ -196,7 +194,6 @@ sink {
         driver = "com.mysql.cj.jdbc.Driver"
         username = "root"
         password = "123456"
-        
         generate_sink_sql = true
         # You need to configure both database and table
         database = test
@@ -209,6 +206,89 @@ sink {
 }
 ```
 
+### Multiple Table Sync
+
+#### Example 1: MySQL CDC Multiple Table Sync
+
+> Sync multiple tables from MySQL CDC to target MySQL database, using 
placeholders for dynamic table name mapping
+
+```
+env {
+  parallelism = 1
+  job.mode = "STREAMING"
+  checkpoint.interval = 5000
+}
+
+source {
+  Mysql-CDC {
+    url = "jdbc:mysql://127.0.0.1:3306/seatunnel"
+    username = "root"
+    password = "******"
+    table-names = ["seatunnel.role","seatunnel.user","galileo.Bucket"]
+  }
+}
+
+transform {
+}
+
+sink {
+  Mysql {
+    url = 
"jdbc:mysql://localhost:3306?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true"
+    driver = "com.mysql.cj.jdbc.Driver"
+    username = "root"
+    password = "123456"
+    generate_sink_sql = true
+    database = "${database_name}_test"
+    table = "${table_name}_test"
+    primary_keys = ["${primary_key}"]
+  }
+}
+```
+
+#### Example 2: JDBC Source Multiple Table Sync to MySQL
+
+> Batch sync multiple tables from MySQL using JDBC Source to another MySQL 
database
+
+```
+env {
+  parallelism = 1
+  job.mode = "BATCH"
+}
+
+source {
+  Jdbc {
+    driver = com.mysql.cj.jdbc.Driver
+    url = "jdbc:mysql://localhost:3306/source_db"
+    username = "root"
+    password = "123456"
+    table_list = [
+      {
+        table_path = "source_db.table_1"
+      },
+      {
+        table_path = "source_db.table_2"
+      }
+    ]
+  }
+}
+
+transform {
+}
+
+sink {
+  Mysql {
+    url = 
"jdbc:mysql://localhost:3306?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true"
+    driver = "com.mysql.cj.jdbc.Driver"
+    username = "root"
+    password = "123456"
+    generate_sink_sql = true
+    database = "${database_name}_target"
+    table = "${table_name}_copy"
+    primary_keys = ["${primary_key}"]
+  }
+}
+```
+
 ## Changelog
 
-<ChangeLog />
\ No newline at end of file
+<ChangeLog />
diff --git a/docs/zh/connector-v2/sink/Mysql.md 
b/docs/zh/connector-v2/sink/Mysql.md
index e95235cb9f..f4d0636dc1 100644
--- a/docs/zh/connector-v2/sink/Mysql.md
+++ b/docs/zh/connector-v2/sink/Mysql.md
@@ -33,7 +33,7 @@ import ChangeLog from '../changelog/connector-jdbc.md';
 
 - [x] [精确一次](../../concept/connector-v2-features.md)
 - [x] [cdc](../../concept/connector-v2-features.md)
-
+- [x] [x] [支持多表写入](../../concept/connector-v2-features.md)
 >使用“Xa事务”来确保“精确一次”。因此,数据库只支持“精确一次”,即
 >支持“Xa事务”。您可以设置`is_exactly_once=true `来启用它。
 
@@ -173,14 +173,11 @@ sink {
     jdbc {
         url = 
"jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true"
         driver = "com.mysql.cj.jdbc.Driver"
-    
         max_retries = 0
         username = "root"
         password = "123456"
         query = "insert into test_table(name,age) values(?,?)"
-    
         is_exactly_once = "true"
-    
         xa_data_source_class_name = "com.mysql.cj.jdbc.MysqlXADataSource"
     }
 }
@@ -197,7 +194,6 @@ sink {
         driver = "com.mysql.cj.jdbc.Driver"
         username = "root"
         password = "123456"
-        
         generate_sink_sql = true
         # You need to configure both database and table
         database = test
@@ -210,6 +206,89 @@ sink {
 }
 ```
 
+### 多表同步
+
+#### 示例1:MySQL CDC 多表同步
+
+> 通过 MySQL CDC 同步多张表到目标 MySQL 数据库,使用占位符实现动态表名映射
+
+```
+env {
+  parallelism = 1
+  job.mode = "STREAMING"
+  checkpoint.interval = 5000
+}
+
+source {
+  Mysql-CDC {
+    url = "jdbc:mysql://127.0.0.1:3306/seatunnel"
+    username = "root"
+    password = "******"
+    table-names = ["seatunnel.role","seatunnel.user","galileo.Bucket"]
+  }
+}
+
+transform {
+}
+
+sink {
+  Mysql {
+    url = 
"jdbc:mysql://localhost:3306?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true"
+    driver = "com.mysql.cj.jdbc.Driver"
+    username = "root"
+    password = "123456"
+    generate_sink_sql = true
+    database = "${database_name}_test"
+    table = "${table_name}_test"
+    primary_keys = ["${primary_key}"]
+  }
+}
+```
+
+#### 示例2:JDBC Source 多表同步到 MySQL
+
+> 从 MySQL 使用 JDBC Source 批量同步多张表到另一个 MySQL 数据库
+
+```
+env {
+  parallelism = 1
+  job.mode = "BATCH"
+}
+
+source {
+  Jdbc {
+    driver = com.mysql.cj.jdbc.Driver
+    url = "jdbc:mysql://localhost:3306/source_db"
+    username = "root"
+    password = "123456"
+    table_list = [
+      {
+        table_path = "source_db.table_1"
+      },
+      {
+        table_path = "source_db.table_2"
+      }
+    ]
+  }
+}
+
+transform {
+}
+
+sink {
+  Mysql {
+    url = 
"jdbc:mysql://localhost:3306?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true"
+    driver = "com.mysql.cj.jdbc.Driver"
+    username = "root"
+    password = "123456"
+    generate_sink_sql = true
+    database = "${database_name}_target"
+    table = "${table_name}_copy"
+    primary_keys = ["${primary_key}"]
+  }
+}
+```
+
 ## 变更日志
 
-<ChangeLog />
\ No newline at end of file
+<ChangeLog />

Reply via email to