Kafka将CDC连接到MSSQL“表必须至少具有一个主键列”

时间:2019-01-07 16:03:13

标签: sql-server apache-kafka-connect confluent cdc

我正在使用带有MSSQL连接器的Kafka Connect和启用CDC的数据库和表。使用REST API创建任务时,出现以下错误:

ERROR Exception thrown while querying for ChangeKey{databaseName=WebAppDb, schemaName=dbo, tableName=Companies} (io.confluent.connect.cdc.mssql.QueryService)
kafka-connect_1     | java.lang.IllegalStateException: Table([dbo].[Companies]) must have at least one primary key column.
kafka-connect_1     |   at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
kafka-connect_1     |   at io.confluent.connect.cdc.mssql.MsSqlQueryBuilder.changeTrackingStatementQuery(MsSqlQueryBuilder.java:81)
kafka-connect_1     |   at io.confluent.connect.cdc.mssql.MsSqlQueryBuilder.changeTrackingStatement(MsSqlQueryBuilder.java:119)
kafka-connect_1     |   at io.confluent.connect.cdc.mssql.QueryService.queryTable(QueryService.java:117)
kafka-connect_1     |   at io.confluent.connect.cdc.mssql.QueryService.processTables(QueryService.java:92)
kafka-connect_1     |   at io.confluent.connect.cdc.mssql.QueryService.run(QueryService.java:67)
kafka-connect_1     |   at com.google.common.util.concurrent.AbstractExecutionThreadService$1$2.run(AbstractExecutionThreadService.java:60)
kafka-connect_1     |   at com.google.common.util.concurrent.Callables$3.run(Callables.java:95)
kafka-connect_1     |   at java.lang.Thread.run(Thread.java:748)

我不明白的是,该表具有主键:

enter image description here

那会是什么?

1 个答案:

答案 0 :(得分:0)

我发现这样做的原因是PK的名称。重命名为不带'。角色作品。应该是个错误。