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

 

question

arsen.gasparyan.05_188257 avatar image
arsen.gasparyan.05_188257 asked ·

Kafka Connector update query issue!

Problem with running this kind of Query on Kafka connector

topic.my_topic.my_ks.my_table.query=UPDATE ks.tbl SET somelist = somelist + [:newitem] WHERE pkey = :pkey;

Can someone bring a realtime working example

How to update my Cassandra's table list column if its type is

...
... list<text>,
...

And can anyone explain, type of 'newitem' it is in my case String ("text") or list of String (["text"]) ?

cassandrakafka-connectorkafkaupdate
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

As Alex Ott and Tomasz Lelek explained in your previous question #5802, bind variables are not supported for CQL collections.

If you were doing this in Java, it is possible to workaround the CQL limitation in this manner:

PreparedStatement ps = session.prepare("UPDATE ks.tbl SET somelist = somelist + ? WHERE pkey = ?");
List listToAppend = ...;     // create a List object
ps.bind(listToAppend, pkey);

But again as both Alex and Tomasz pointed out, this isn't possible to do with the current version of the Kafka connector since it doesn't do any transformation on the Kafka topic query. I'm sorry that we don't have a solution available at this time. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.