使用tidb lighting和dumpling工具导入导出数据的时候,支持目标表比原表多一个字段列吗,如果支持的话需要怎么导入导出呀

tiup tidb-lightning -config tidb-lightning.toml
Starting component tidb-lightning: /root/.tiup/components/tidb-lightning/v8.5.1/tidb-lightning -config tidb-lightning.toml
Verbose debug logs will be written to tidb-lightning-uat.log

±–±---------------------------------------------±------------±-------+
| # | CHECK ITEM | TYPE | PASSED |
±–±---------------------------------------------±------------±-------+
| 1 | Source data files size is proper | performance | true |
±–±---------------------------------------------±------------±-------+
| 2 | the checkpoints are valid | critical | true |
±–±---------------------------------------------±------------±-------+
| 3 | Cluster version check passed | critical | true |
±–±---------------------------------------------±------------±-------+
| 4 | Lightning has the correct storage permission | critical | true |
±–±---------------------------------------------±------------±-------+

Import Data Error Summary:
±–±-----------±------------±--------------------------------------+
| # | ERROR TYPE | ERROR COUNT | ERROR DATA TABLE |
±–±-----------±------------±--------------------------------------+
| 1 | Data Type | 10 | lightning_task_info.type_error_v2 |
±–±-----------±------------±--------------------------------------+

tidb lightning encountered error: [Lightning:Restore:ErrEncodeKV]encode kv error in file hetu-cloud-new.robot_task_file_cold.0000005410000.sql:0 at offset 544: The number of type errors exceeds the threshold configured by max-error.type: ‘10’: column count mismatch, expected 13, got 12

可以支持,但需要手动处理。Dumpling导出时默认会导出所有字段,Lightning导入时目标表多出的字段必须有默认值或允许为NULL。

支持。Lightning 按列名匹配而非按位置,目标表比源多列没问题,多出的列取默认值或 NULL(须允许 NULL 或有 default)。关键是文件的列要能对应上:Dumpling 导出的 SQL 文件带列名,Lightning 会按列名对齐;若是无表头 CSV,需在 tidb-lightning.toml 的 [mydumper.csv] 配 header=true,或用 [[mydumper.files]] 显式指定列映射。建议目标表先建好完整结构、多出的列设好 default,再导入。反过来目标比源少列会报错。

试过了,导出为csv,目标端最后多列没影响。sql的话,估计就得想办法写全字段了。

column count mismatch, expected 13, got 12 导入的数据列数与目标表的列数不匹配,且错误数量达到了设定的上限,导致任务中断。

这个导入的时候应该会报字段太多的问题吧

支持支持