1

I have following table structure in cassandra

CREATE TABLE IF NOT EXISTS ks.job_status(
    job_uuid text,
    job_updated_status text,
    job_status_description text,
    PRIMARY KEY(job_uuid)
);

I am using below query to update a non-existent record in the table

update ks.job_status 
set job_updated_status='gerp', 
    job_status_description='hello' 
where job_uuid = 'abc'

I am expecting some error, as the record i am trying to update is not existing. But as mention in the cqlsh docs the update is behaving as an upsert and it is creating a new record.

What should be my update query in order to update the data only if the record exist?

ernest_k
  • 44,416
  • 5
  • 53
  • 99
Katiyman
  • 827
  • 2
  • 12
  • 32
  • 3
    The [second answer](https://stackoverflow.com/a/31101500/5761558) on that question shows how you can use `IF EXISTS` to prevent insertion when record does not exist. – ernest_k Nov 05 '19 at 09:46

0 Answers0