Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Latest commit

 

History

History
 
 

connect-jdbc-vertica-sink

JDBC Vertica sink connector

asciinema

Objective

Quickly test JDBC Sink connector with Vertica.

How to run

Simply run:

$ ./vertica-sink.sh

Details of what the script is doing

Create the table and insert data.

$ docker exec -i vertica /opt/vertica/bin/vsql -hlocalhost -Udbadmin << EOF
create table mytable(f1 varchar(20));
EOF

Sending messages to topic mytable

$ seq -f "{\"f1\": \"value%g\"}" 10 | docker exec -i connect kafka-avro-console-producer --broker-list broker:9092 --property schema.registry.url=http://schema-registry:8081 --topic mytable --property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}]}'

Creating JDBC Vertica sink connector

$ curl -X PUT \
     -H "Content-Type: application/json" \
     --data '{
               "connector.class" : "io.confluent.connect.jdbc.JdbcSinkConnector",
                    "tasks.max" : "1",
                    "connection.url": "jdbc:vertica://vertica:5433/docker?user=dbadmin&password=",
                    "auto.create": "true",
                    "topics": "mytable"
          }' \
     http://localhost:8083/connectors/jdbc-vertica-sink/config | jq .

Check data is in Vertica

$ docker exec -i vertica /opt/vertica/bin/vsql -hlocalhost -Udbadmin << EOF
select * from mytable;
EOF

Results:

   f1
---------
 value10
 value1
 value5
 value3
 value8
 value6
 value9
 value4
 value7
 value2
(10 rows)

N.B: Control Center is reachable at http://127.0.0.1:9021