Update single column in cassandra

341 Views Asked by At

I have following cassandra column family:

create column family cfn
 with comparator = UTF8Type
 and key_validation_class = UUIDType
 and column_metadata =[
      {column_name:email, validation_class: UTF8Type,index_type: KEYS}
      {column_name:full_name, validation_class: UTF8Type}
 ];

I want to update "full_name" of given "email" but i don't know the row key i only have "email". How can i do that using hector thrift api?

I know that i will have to insert a new column as there is no update kind of thing in cassandra. Will it be necessary to get row key before inserting new column for the same row?

1

There are 1 best solutions below

4
On

Inserting using cassandra-cli or hector is the most basic thing. May be you need to brush your cassandra repo Read This.

Try this using cli

SET cfn[RowKey]['full_name']='XYZ'; 
/*
 *Remember you have mentioned your key as UUID Type. So while providing a Rowkey it should   
 *be in UUID type only. e.g  8aff3820-1e55-11b2-a248-41825ac3edd8
 */
SET cfn[RowKey]['email']='[email protected]';

Retrieve Data,

list cfn;