I want to know, Does Datastax Kafka connector gives the ability to choose to insert or update query based on the field to exist in massage or not?
Bringing together the Apache Cassandra experts from the community and DataStax.
Want to learn? Have a question? Want to share your expertise? You are in the right place!
Not sure where to begin? Getting Started
I want to know, Does Datastax Kafka connector gives the ability to choose to insert or update query based on the field to exist in massage or not?
I don't quite understand what you're asking. Perhaps if you give an example of what query you want and the things you've tried that hasn't work, I'd be able to assist you better. Cheers!
The connector gives the following abilities.
topic.my_topic.my_ks.my_table.query=INSERT INTO ks.tbl(pkey,ccol,x) VALUES :pkey, :ccol, :x);
topic.my_topic.my_ks.my_table.query=UPDATE ks.tbl SET somelist = somelist + [:newitem] WHERE pkey = :pkey;
I want to choose if 'newitem' field exists in my message do update query not insert.
Hello, the .query setting can accept any valid CQL query, but currently, we do not support multiple queries set for the same topic.keyspace.table.
You need to pick one CQL query that will be executed for every record that arrives at the Kafka topic.
This is my table schema
CREATE TABLE test.test ( id int, user_id text, date timestamp, value double, log list<text>, PRIMARY KEY ((id, user_id), date) );
{"date":"2020-06-05 16:03:44.731","id":1234,"userId":"a1234","value":20.4}
or
{"date":"2020-06-05 16:03:44.731","id":1234,"userId":"a1234","value":20.4,"log":"log message"}
I want to do insert query when the 'log' field doesn't exist
or do update already existing row when it exists.
5 People are following this question.
Why does LOCAL_QUORUM with Kafka connector result in large number of timeouts?
Can't do update query via Kafka Connector.
Is it possible to map messages from the same topic that have different Avro schemas?
Issue with spring-boot-starter-data-cassandra and spark-cassandra-connector?
How can I download a specific version of the spark-cassandra-connector?
DataStax Enterprise is powered by the best distribution of Apache Cassandra ™
© 2022 DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.
Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.
Privacy Policy Terms of Use