The route module defines rules to map source tables to sink tables. This topic describes the syntax for defining routing rules.
Parameters
Parameter | Description | Required | Remarks |
| Specifies the source table. | Required | Supports regular expressions. |
| Specifies the sink table. | Required | |
| Specifies the string in the sink table name to be replaced by the source table name. | Optional | For example, when |
| The description of the routing rule. | Optional |
Perform a stateless startup after modifying the route module to apply the new rules.
Examples
Sync data from a source table to a sink table
Route data from the source table mysql_db.web_order to the sink table sink_db.ods_web_order:
route:
- source-table: mysql_db.web_order
sink-table: sink_db.ods_web_order
description: sync data from a source table to a sink tableSync data from a source table to multiple sink tables
To copy data from a source table to multiple sink tables, define multiple routing rules. The following code replicates data from mydb.orders to sink_db.orders and backup_sink_db.orders at the same time.
route:
- source-table: mydb.orders
sink-table: sink_db.orders
- source-table: mydb.orders
sink-table: backup_sink_db.ordersSync data from multiple source tables to multiple sink tables
Define multiple rules using a hyphen (-), which is the YAML list indicator. All these rules are applied concurrently.
route:
- source-table: mydb.orders
sink-table: ods_db.ods_orders
description: sync orders table to ods_orders
- source-table: mydb.shipments
sink-table: ods_db.ods_shipments
description: sync shipments table to ods_shipments
- source-table: mydb.products
sink-table: ods_db.ods_products
description: sync products table to ods_productsSync data from multiple source tables to a sink table
Merge all tables from the source_db database into the target sink_db.merged table.
route:
- source-table: source_db.\.*
sink-table: sink_db.merged
description: sync data from multiple source tables to a sink tableDatabase synchronization
Sync all tables from the source_db database to corresponding tables in the sink_db database, keeping the table names unchanged.
route:
- source-table: source_db.\.*
sink-table: sink_db.<>
replace-symbol: <>
description: route all tables in source_db to sink_dbThe <> symbol is a placeholder for the source table name, enabling one-to-one mapping from source tables to sink tables.