Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
baisui1981 opened this issue Apr 20, 2024 · 0 comments
Closed

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

baisui1981 opened this issue Apr 20, 2024 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@baisui1981
Copy link
Member

baisui1981 commented Apr 20, 2024

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:https://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 baisui1981 added this to the V4.1.0 milestone Apr 21, 2024
@baisui1981 baisui1981 added the bug Something isn't working label Apr 21, 2024
@baisui1981 baisui1981 modified the milestones: V4.1.0, V4.0.1 Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant