简体   繁体   中英

Kafka Sink Connector without a primary key

Is it possible to write to a sink connector that will update a record in a SQL-Server database based on a where clause?

    user
    - ssn int (pk)
    - name varchar
    - email varchar (no index)
    - status

the topic will only contain

    - name
    - email
    - new_status

I would like the sink connector to perform something similar to the sql

update user
set status = <new_status>
where email = <email>

Is this possible with a sink connector?

You can use these properties if you want to update/upsert by email field

"pk.mode": "record_value",
"pk.fields": "email"

https://docs.confluent.io/kafka-connectors/jdbc/current/sink-connector/sink_config_options.html#writes

You can see there, WHERE query cannot be customized like for the source connector

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM