How does JDBC sink connector inserts values into postgres database

Viewed 1349

I'm using JDBC sink connector to load data from kafka topic to postgres database.

here is my configuration:

curl --location --request PUT 'http://localhost:8083/connectors/sink_1/config' \
--header 'Content-Type: application/json' \
--data-raw '{
 "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
 "connection.url":"jdbc:postgresql://localhost:5432/postgres",
 "connection.user":"user",
 "connection.password":"passwd",
 "tasks.max" : "10",
 "topics":"<topic_name_same_as_tablename>",
 "insert.mode":"insert",
  "key.converter":"org.apache.kafka.connect.converters.ByteArrayConverter",
 "value.converter":"org.apache.kafka.connect.json.JsonConverter",
 "quote.sql.identifiers":"never",
 "errors.tolerance":"all",
 "errors.deadletterqueue.topic.name":"failed_records",
 "errors.deadletterqueue.topic.replication.factor":"1",
 "errors.log.enable":"true"
}'

In my table, I have 100k+ records so, I tried partitioning the topic into 10 and I tried with tasks.max with 10 to speed up the loading process, which was much faster when compared to single partition.

Can someone help me understand how the sink connector loads data into postgres? How will be the insert statement it will consider? either approach-1 or approach-2? If it is approach-1 then can we achieve approach-2? if yes, how can we?

either approach-1 or approach-2

0 Answers
Related