0

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?

Manish Kumar
  • 10,214
  • 25
  • 77
  • 147

1 Answers1

0

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']='XYZ@GMAIL.COM';

Retrieve Data,

list cfn;
abhi
  • 4,762
  • 4
  • 29
  • 49
  • can you share **describe #KeyspaceName** output from cqlsh shell? – abhi May 03 '13 at 17:58
  • FYI, when you create a columnfamily from cli, by default rowkey name is **key** of type **uuid** – abhi May 03 '13 at 18:04
  • Imagine a web application. Will it be a safe option to send row key in a response. It may be dangerous to alter the DB. am i right – Manish Kumar May 04 '13 at 11:46
  • Not always necessarily. Though if you don't want that discrepancy try to create column family from any of cassandra client API's or cql shell. – abhi May 04 '13 at 12:06