默认对大小写敏感
测试环境为MySQL 没有找到怎么忽略大小写的设置
--数据库中是大写 我这里写成了小写导致无法获取数据
CREATE TABLE test (
no STRING NOT NULL,
xm STRING,
ks STRING,
dwmc STRING,
dwdm STRING,
gwmc STRING,
gwdm STRING,
primary key (no) not enforced
) WITH (
'connector' = 'mysql-cdc',
'hostname' = '192.168.0.65',
'port' = '3306',
'username' = 'root',
'password' = 'root',
'database-name' = 'mock_middle',
'table-name' = 'test'
);
-- 改成大写就行了
CREATE TABLE test (
NO STRING NOT NULL,
XM STRING,
KS STRING,
DWMC STRING,
DWDM STRING,
GWMC STRING,
GWDM STRING,
primary key (NO) not enforced
) WITH (
'connector' = 'mysql-cdc',
'hostname' = '192.168.0.65',
'port' = '3306',
'username' = 'root',
'password' = 'root',
'database-name' = 'mock_middle',
'table-name' = 'test'
);
数据同步的必须要有唯一索引或者主键
没有主键,建立一个唯一索引也行, 没有也行,但是数据会出错 https://nightlies.apache.org/flink/flink-docs-master/zh/docs/dev/table/sql/create/#primary-key
- scan.incremental.snapshot.enabled=false
单个主键设置
PRIMARY KEY (NO) NOT ENFORCED
多个主键设置
PRIMARY KEY (NO, XM, KS) NOT ENFORCED