How to update clustering key in cassandra using update request?

This is my table structure and I am updating the sequence with the following query:

Update styles set sequence=1 where styleid = 'CLASSIC';

I get an error like

PRIMARY KEY part sequence found in SET part
Missing PRIMARY KEY part sequence

CREATE TABLE styles (
  styleid ascii,
  sequence int,
  active boolean,
  image ascii,
  name ascii,
  PRIMARY KEY (styleid, sequence)
) WITH CLUSTERING ORDER BY (sequence DESC);

Please help me update the clustering key sequence so that it is updated. Or any alternative method, please share.

+5
source share
2 answers

Based on how Cassandra stores data, updating clustering columns (primary key) is not possible.

Rowkey which is a combination **styleid** ->[sequence] -> [active boolean,image ascii, name ascii]

To specify non-primary columns for updating / deletion, you must analyze the section styleid -> sequenceto get into the columns.

, , Cassandra. , "" .

+1

, Cassandra, , , .

, , . , .

: 1) , , - . 2) ( Javascript, Java, , ). 3) , , ( , , , - , .

-1

All Articles