Is there any way to prevent the CQL command Update from creating a new row if the row key ‘row1’ doesn’t exist?
UPDATE columnfamily SET data = 'test data' WHERE key = 'row1';
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Update 2015-04-10:
As of Cassandra 2.0 you can use light weight transactions to accomplish this. Be aware that although they are called “light weight” these queries require a lot more work to be done on the Cassandra cluster.
Thanks to @BSB for the update.
Pre 2.0 answer:
No. Unlike in SQL, in CQL
Updateandinsertare semantically the same. You would have to do a read first to determine the existence of the row.