datax配置部分列更新,提示没有找到主健列,但已经有主键列

Viewed 56

doris建表语句如下:
CREATE TABLE IF NOT EXISTS test
(
id LARGEINT NOT NULL ,
order_code VARCHAR(50),
line_code VARCHAR(20) ,
remark VARCHAR(900) ,
unit_no TINYINT",
unit_name VARCHAR(500) ",
price VARCHAR(500) ",
register_time DATETIME
)
UNIQUE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"enable_unique_key_merge_on_write" = "true"
);
datax的loadProps配置如下:

"loadProps": {
"format": "json",
"partial_columns": "true",
"strip_outer_array":"true",
"line_delimiter": "\x02"
}
datax详细配置如下:
{
"job": {
"content": [
{
"reader": {
"name": "mysqlreader",
"parameter": {
"column": ["id","order_code","line_code","remark","unit_no","unit_name","price"],
"connection": [
{
"jdbcUrl": ["jdbc:mysql://localhost:3306/demo"],
"table": ["test"]
}
],
"username": "root",
"password": "xxxxx",
"where": ""
}
},
"writer": {
"name": "doriswriter",
"parameter": {
"loadUrl": ["127.0.0.1:8030"],
"column": ["id","order_code","line_code","remark","unit_no","unit_name","price"],
"username": "root",
"password": "xxxxxx",
"postSql": [],
"preSql": [],
"flushInterval":30000,
"connection": [
{
"jdbcUrl": "jdbc:mysql://127.0.0.1:9030/demo",
"selectedDatabase": "demo",
"table": ["test"]
}
],
"loadProps": {
"format": "json",
"partial_columns": "true",
"strip_outer_array":"true",
"line_delimiter": "\x02"
}
}
}
}
],
"setting": {
"speed": {
"channel": "1"
}
}
}
}
为什么datax会提示Partial update should include all key columns,missing:id
是我哪里配置错误了吗?

1 Answers

需要在loadProps中加个columns,指定要导入的列(必须包含所有 key 列,不然无法更新),可参考:主键模型的导入更新