Art
Art

Reputation: 5924

How do you update all column values in Cassandra without specifying the keys?

Let's say I have the following table(only bigger):

key     |  type
----------------
uuid1   |  blue
uuid2   |  red
uuid3   |  blue

What I want to be able to do is change everything that is blue to green. How would I do this without specifying all the UUIDs with the CLI or CQL?

Upvotes: 4

Views: 5531

Answers (1)

rs_atl
rs_atl

Reputation: 8985

You have a couple choices:

  1. You can put a secondary index on the "type" column, then query all items equal to "blue". Once you have those you'll have all their keys, and you can do a batch mutation to set all the values to "green".

  2. You can use the Hadoop integration to read in all the columns, then output the updated data in your reducer. Pig would be a good choice for this type of work.

Upvotes: 3

Related Questions