赞
踩
“org.apache.flink.table.api.validationexception: ‘scan.incremental.snapshot.chunk.key-column’ must be set when the table doesn’t have primary keys”
报错提示当表没有主键时,必须设置 ‘scan.incremental.snapshot.chunk.key-column’。
这里表没有主键,不是flink table中设置的primary key,而是物理表中没有主键。
如上述报错提示:在创建表的时候,为没有主键的表指定一个唯一的标识列作为’scan.incremental.snapshot.chunk.key-column’。如下
为MY_TABLE表指定了id列作为’scan.incremental.snapshot.chunk.key-column’。这样就可以解决没有主键的表无法进行增量捕获的问题。
CREATE TABLE IF NOT EXISTS my_table ( id BIGINT, name STRING, age INT, PRIMARY KEY (id) NOT ENFORCED ) WITH ( 'connector' = 'mysql-cdc', 'hostname' = 'xxx', 'port' = '1521', 'username' = 'conn_uat', 'password' = 'xxxx', 'database-name' = 'CONN_UAT', 'schema-name' = 'strc', 'table-name' = 'MY_TABLE', 'scan.incremental.snapshot.chunk.key-column' = 'id' );
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。