默认对大小写敏感

测试环境为MySQL 没有找到怎么忽略大小写的设置

  1. --数据库中是大写 我这里写成了小写导致无法获取数据
  2. CREATE TABLE test (
  3. no STRING NOT NULL,
  4. xm STRING,
  5. ks STRING,
  6. dwmc STRING,
  7. dwdm STRING,
  8. gwmc STRING,
  9. gwdm STRING,
  10. primary key (no) not enforced
  11. ) WITH (
  12. 'connector' = 'mysql-cdc',
  13. 'hostname' = '192.168.0.65',
  14. 'port' = '3306',
  15. 'username' = 'root',
  16. 'password' = 'root',
  17. 'database-name' = 'mock_middle',
  18. 'table-name' = 'test'
  19. );
  20. -- 改成大写就行了
  21. CREATE TABLE test (
  22. NO STRING NOT NULL,
  23. XM STRING,
  24. KS STRING,
  25. DWMC STRING,
  26. DWDM STRING,
  27. GWMC STRING,
  28. GWDM STRING,
  29. primary key (NO) not enforced
  30. ) WITH (
  31. 'connector' = 'mysql-cdc',
  32. 'hostname' = '192.168.0.65',
  33. 'port' = '3306',
  34. 'username' = 'root',
  35. 'password' = 'root',
  36. 'database-name' = 'mock_middle',
  37. 'table-name' = 'test'
  38. );

数据同步的必须要有唯一索引或者主键

没有主键,建立一个唯一索引也行, 没有也行,但是数据会出错 https://nightlies.apache.org/flink/flink-docs-master/zh/docs/dev/table/sql/create/#primary-key

  • scan.incremental.snapshot.enabled=false
  • image.png

image.png

单个主键设置

  1. PRIMARY KEY (NO) NOT ENFORCED

多个主键设置

  1. PRIMARY KEY (NO, XM, KS) NOT ENFORCED