Slice deletes are not supported currently.  It is being worked on. 
https://issues.apache.org/jira/browse/CASSANDRA-3708

-Jeremiah


On May 14, 2012, at 12:18 PM, Roland Mechler wrote:


I have a table with a 3 part composite key and I want to delete rows based on 
the first 2 parts of the key. SELECT works using 2 parts of the key, but DELETE 
fails with the error:

    Bad Request: Missing mandatory PRIMARY KEY part part3

(see details below). Is there a reason why deleting based on the first 2 parts 
should not work? I.e., is it just currently not supported, or is it a permanent 
limitation?

Note that deleting based on just the first part of the key will work… deletes 
all matching rows.

cqlsh:Keyspace1> CREATE TABLE MyTable (part1 text, part2 text, part3 text, data 
text, PRIMARY KEY(part1, part2, part3));
cqlsh:Keyspace1> INSERT INTO MyTable (part1, part2, part3, data) VALUES (‘a’, 
‘b’, ‘c’, ‘d’);
cqlsh:Keyspace1> SELECT * FROM MyTable WHERE part1 = ‘a’ AND part2 = ‘b’;
part1 | part2 | part3 | data
——-+——-+——-+——
a | b | c | d

cqlsh:Keyspace1> DELETE FROM MyTable WHERE part1 = ‘a’ AND part2 = ‘b’;
Bad Request: Missing mandatory PRIMARY KEY part part3
cqlsh:Keyspace1> DELETE data FROM MyTable WHERE part1 = ‘a’ AND part2 = ‘b’;
Bad Request: Missing mandatory PRIMARY KEY part part3
cqlsh:Keyspace1> DELETE FROM MyTable WHERE part1 = ‘a’;
cqlsh:Keyspace1> SELECT * FROM MyTable WHERE part1 = ‘a’ AND part2 = ‘b’;
cqlsh:Keyspace1>

-Roland

Reply via email to