In the flink code, I am reading data from a Kafka ...
# troubleshooting
a
In the flink code, I am reading data from a Kafka topic and sinking the results to postgresDB. This works fine. If now I want to check if there exists an entry in the database for the same message that came in from Kafka and then decide if I want to update the row or insert a new row, how can I achieve this?
s
Well, one approach could be we use primary key clause in flink jdbc sink DDL. If you want to update selective columns in target table, then use a lookup join with target table - this can help you identify which records will get inserted and which one get updated.
a
But if I am using a datastream, how can I achieve this?
s
You can implement it as an upsert in Postgres
πŸ‘ 1
a
Yes got it... Thank you