tis icon indicating copy to clipboard operation
tis copied to clipboard

MySQL->Mongo 数据同步 tinyint(1) 类型映射问题

Open baisui1981 opened this issue 1 year ago • 0 comments

MySQL表 ddl:

CREATE TABLE `orderdetail_01` (
  `order_id` varchar(32) ,
  `is_limittime` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1
{
	"job":{
		"content":[
			{
				"reader":{
					"parameter":{
						"password":"xxxxxx",
						"column":[
							"`order_id`",
							"`is_limittime`"
						],
						"connection":[
							{
								"jdbcUrl":[
									"jdbc:mysql://192.168.28.200:3306/order2?useUnicode=yes&useCursorFetch=true&useSSL=false&serverTimezone=Asia%2FShanghai&useCompression=true&characterEncoding=utf8"
								],
								"table":[
									"`orderdetail_01`",
									"`orderdetail_02`"
								]
							}
						],
						"dataxName":"mysql_mongo",
						"username":"root"
					},
					"name":"mysqlreader"
				},
				"writer":{
					"parameter":{
						"userPassword":"xxxxxx",
						"address":[
							"192.168.28.201:27017"
						],
						"dbName":"tis",
						"column":[
							{
								"name":"order_id",
								"type":"string"
							},					
							{
								"name":"is_limittime",
								"type":"boolean" // 此处映射成boolean类型
							}						
						],
						"writeMode":{
							"isReplace":true,
							"replaceKey":"order_id"
						},
						"userName":"admin",
						"collectionName":"orderdetail",
						"dataxName":"mysql_mongo"
					},
					"name":"mongodbwriter"
				},
				"dataxName":"mysql_mongo"
			}
		],
		"setting":{
			"errorLimit":{
				"record":1,
				"percentage":0.02
			},
			"speed":{
				"channel":3
			}
		}
	}
}

在执行过程中通过DataX读取的内容为:

{
		"byteSize": 1,
		"index": 42,
		"rawData": 0,
		"type": "LONG" // 从MySQL读取的内容变成Long
	}

随之报告的错误为: "message": "record's [42] column's type should be: boolean"

baisui1981 avatar Apr 20 '24 05:04 baisui1981