2013-01-04 66 views
0

目前收到此錯誤消息(即使我創建一個索引。):卡桑德拉:無法更新與非主鍵的排

請求無效:預期主要的「關鍵」存在WHERE子句中對於「UserGameAnswers」

cqlsh:godofsports> UPDATE UserGameAnswers SET 'status' = 'thing' WHERE 'event_question_id' = '7'; 
Bad Request: Expected key 'KEY' to be present in WHERE clause for 'UserGameAnswers' 

鑑於我對這個列鍵索引(見下文)和this should be allowed我究竟做錯了什麼?

cqlsh:godofsports> DESCRIBE COLUMNFAMILY UserGameAnswers; 

CREATE TABLE UserGameAnswers (
    KEY text PRIMARY KEY, 
    event_question_id text 
) WITH 
    comment='' AND 
    comparator=ascii AND 
    read_repair_chance=0.100000 AND 
    gc_grace_seconds=864000 AND 
    default_validation=text AND 
    min_compaction_threshold=4 AND 
    max_compaction_threshold=32 AND 
    replicate_on_write='true' AND 
    compaction_strategy_class='SizeTieredCompactionStrategy' AND 
    compression_parameters:sstable_compression='SnappyCompressor'; 

CREATE INDEX event_question_id_idx ON UserGameAnswers (event_question_id); 

我是否需要先進行查詢才能獲取實際的KEY? :(

+0

我在其他查詢獲取所有的鍵,現在看來你不能使用()的。二級索引... – olive

回答

1

是 - 你需要確定鍵和編寫針對該更新