@@ -29,6 +29,7 @@ null = '\N'
29
29
include-commit-ts = true
30
30
binary-encoding-method = ' base64'
31
31
output-old-value = false
32
+ output-field-header = false # 从 v9.0.0 开始引入
32
33
```
33
34
34
35
## 数据保存的事务性约束
@@ -52,6 +53,12 @@ CSV 文件中,单行的每一列定义如下:
52
53
- 第五列:` is-update ` ,该列仅在 ` output-old-value ` 为 true 时存在,用于标识该行变更来自 Update 事件(值为 true),还是来自 Insert/Delete 事件(值为 false)。
53
54
- 第六列至最后一列:变更数据的列,可为一列或多列。
54
55
56
+ 当配置中 ` output-field-header = true ` 时,CSV 文件将包含一个表头行,表头行的列名如下:
57
+
58
+ | 第一列 | 第二列 | 第三列 | 第四列(可选) | 第五列(可选) | 第六列 | ... | 最后一列 |
59
+ | --- | --- | --- | --- | --- | --- | --- | --- |
60
+ | ` ticdc-meta$operation ` | ` ticdc-meta$table ` | ` ticdc-meta$schema ` | ` ticdc-meta$commit-ts ` | ` ticdc-meta$is-update ` | 涉及数据变更的第一列的列名 | ... | 涉及数据变更的最后一列的列名 |
61
+
55
62
假设某张表 ` hr.employee ` 的定义如下:
56
63
57
64
``` sql
@@ -86,6 +93,19 @@ CREATE TABLE `employee` (
86
93
"I","employee","hr",433305438660591630,true,102,"Alex","Alice","2018-06-15","Beijing"
87
94
```
88
95
96
+ 当配置中 ` include-commit-ts = true ` 且 ` output-old-value = true ` 且 ` output-field-header = true ` 时,该表上的 DML 事件以 CSV 格式存储后如下所示:
97
+
98
+ ``` csv
99
+ ticdc-meta$operation,ticdc-meta$table,ticdc-meta$schema,ticdc-meta$commit-ts,ticdc-meta$is-update,Id,LastName,FirstName,HireDate,OfficeLocation
100
+ "I","employee","hr",433305438660591626,false,101,"Smith","Bob","2014-06-04","New York"
101
+ "D","employee","hr",433305438660591627,true,101,"Smith","Bob","2015-10-08","Shanghai"
102
+ "I","employee","hr",433305438660591627,true,101,"Smith","Bob","2015-10-08","Los Angeles"
103
+ "D","employee","hr",433305438660591629,false,101,"Smith","Bob","2017-03-13","Dallas"
104
+ "I","employee","hr",433305438660591630,false,102,"Alex","Alice","2017-03-14","Shanghai"
105
+ "D","employee","hr",433305438660591630,true,102,"Alex","Alice","2017-03-14","Beijing"
106
+ "I","employee","hr",433305438660591630,true,102,"Alex","Alice","2018-06-15","Beijing"
107
+ ```
108
+
89
109
## 数据类型映射
90
110
91
111
| MySQL 类型 | CSV 类型 | 示例 | 描述 |
0 commit comments