0

I want to do batch update for all rows, using update query. I know there is BATCH query. But, I have to list all rows..

So, I want to do something like :

UPDATE test set value=0x31 where id in ( SELECT id from test );

Is there any way doing something like the above?

The idea is the same as SQL. select all rows & and insert them into "in" part.

The reason why I want to do this is that I added a new column to the existing column family, which created null data in the new created column. And, this cause an error for retrieving data from Cassandra.

user2533493
  • 81
  • 2
  • 12

1 Answers1

0

I think the examples shown here might help: http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/update_r.html?scroll=reference_ds_g4h_qzq_xj__description_unique_31

Update a column in several rows at once:

UPDATE users SET state = 'TX' WHERE user_uuid IN (88b8fd18-b1ed-4e96-bf79-4280797cba80, 06a8913c-c0d6-477c-937d-6c1b69a95d43, bc108776-7cb5-477f-917d-869c12dfffa8);

catpaws
  • 2,263
  • 16
  • 18
  • Thank you for the comment. The problem of that approach is that I have to list all possible value, e.g. in this case, all values of user_uuid. Point is how to update "all" columns without listing up all values. if there is a ways by just one command, it is very useful. – user2533493 Aug 30 '14 at 00:48
  • Sorry, not "all" columns. it is all "rows". – user2533493 Aug 30 '14 at 01:18