You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Leonard Xu (Jira)" <ji...@apache.org> on 2020/12/02 14:17:00 UTC
[jira] [Commented] (FLINK-20452) Mysql JDBC Sink
UpsertStreamTableSink requires that Table has a full primary keys
[ https://issues.apache.org/jira/browse/FLINK-20452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17242387#comment-17242387 ]
Leonard Xu commented on FLINK-20452:
------------------------------------
[~HideOnBush]
Thanks for the report, but i think it's not a bug, please use new connector which identifier is `connector` = `jdbc` rather than `connector.type` = 'jdbc', `connector.type` = 'jdbc' will use legacy connector and the legacy connector does not support use primary key when write a upsert stream to database.
please see 1.11 doc[1] for more information how to define a JDBC table.
[1]https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/connectors/jdbc.html#how-to-create-a-jdbc-table
> Mysql JDBC Sink UpsertStreamTableSink requires that Table has a full primary keys
> ---------------------------------------------------------------------------------
>
> Key: FLINK-20452
> URL: https://issues.apache.org/jira/browse/FLINK-20452
> Project: Flink
> Issue Type: Bug
> Environment: {code:java}
> CREATE TABLE table_name (
> report_date VARCHAR not null,
> group_id VARCHAR not null,
> shop_id VARCHAR not null,
> shop_name VARCHAR,
> food_category_name VARCHAR,
> food_name VARCHAR,
> unit VARCHAR,
> rt_food_unit_cnt BIGINT,
> rt_food_unit_real_amt double,
> rt_food_unit_bill_rate double,
> rt_food_unit_catagory_rate double,
> rt_food_unit_all_rate double,
> PRIMARY KEY (report_date, group_id, shop_id) NOT ENFORCED
> ) WITH (
> 'connector.type' = 'jdbc',
> 'connector.driver' = 'com.mysql.jdbc.Driver',
> 'connector.url' = 'jdbc:mysql://host:port/db?autoReconnect=true',
> 'connector.table' = 'table',
> 'connector.username' = 'xxx',
> 'connector.password' = 'xxx',
> 'connector.write.flush.max-rows' = '100'
> )
> {code}
> Reporter: HideOnBush
> Priority: Blocker
>
> I specified PRIMARY KEY (report_date, group_id, shop_id) NOT ENFORCED when I created the table in 1.11, but I still get an error when I execute insert into Mysql JDBC Sink: UpsertStreamTableSink requires that Table has a full primary keys if it is updated? Why?1.11 Doesn't it support DDL to specify Primary key?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)