通过ODBC创建Mysql外表,可以创建,但是无法执行。
想了解下Mysql外表有些什么限制,比如DEFAULT CHARSET之类的限制
报错信息:
Please check your sql, we meet an error when parsing.
Mysql建表语句:
CREATE TABLE `lc_datasource_target_template` (
`id` bigint(15) NOT NULL AUTO_INCREMENT COMMENT '',
`tenant_id` varchar(50) NOT NULL COMMENT '',
`data_date` varchar(20) NOT NULL COMMENT '',
`dimension_type` varchar(50) NOT NULL COMMENT '',
`dimension_value` varchar(150) NOT NULL COMMENT '',
`target_type` varchar(20) NOT NULL COMMENT '',
`target_value` decimal(10,4) NOT NULL COMMENT '',
`ds_id` varchar(50) NOT NULL COMMENT '',
`createtime` datetime NOT NULL COMMENT '',
`updatetime` datetime NOT NULL COMMENT '',
`template_type` varchar(10) NOT NULL COMMENT '',
PRIMARY KEY (`id`),
UNIQUE KEY `uni` (`tenant_id`,`data_date`,`dimension_type`,`dimension_value`,`target_type`,`ds_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=553 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Doris建表:
CREATE EXTERNAL TABLE lc_external.external_dental_target (
`id` bigint(15) ,
`tenant_id` varchar(50),
`data_date` varchar(20),
`dimension_type` varchar(50),
`dimension_value` varchar(150),
`target_type` varchar(20),
`target_value` decimal(10,4),
`ds_id` varchar(50),
`createtime` datetime,
`updatetime` datetime,
`template_type` varchar(10)
) ENGINE=ODBC
COMMENT "MYSQL"
PROPERTIES (
"odbc_catalog_resource" = "mysql_odbc_bi_product",
"database" = "polaris",
"table" = "lc_datasource_target_template"
);
我用的sql server
排查下来,是COLLATE=utf8mb4_0900_ai_ci导致的;
COLLATE=utf8mb4_general_ci 可以拉取
错误信息:
SQL 错误 [1064] [42000]: errCode = 2, detailMessage = Please check your sql, we meet an error when parsing.
抱歉漏贴版本了,版本是0.14.7
请贴一下具体错误,以及doris版本