我是 Cassandra 的新手,在尝试删除表中的多行时遇到了一些问题。我有一个定义如下的表:
CREATE TABLE aze.isis_users (
identifier text PRIMARY KEY,
iteration_count int,
password_expires_on date,
passwordword blob,
roleidentifier text,
salt blob
) WITH additional_write_policy = '99p'
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND cdc = false
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND default_time_to_live = 0
AND extensions = {}
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair = 'BLOCKING'
AND speculative_retry = '99p';
我希望能够使用 roleidentifier = lim_user
删除所有行
我在 2 个不同的查询中得到以下 2 个错误:
最佳答案
在 Cassandra 中不是这样工作的。您需要在 DELETE
命令中指定完整或部分主键。如果要通过非主键/分区键删除,则需要先找到具有该值的行,提取主键,然后通过主键删除。
您可以在 this answer 中找到实现此目的的方法.
关于cassandra - 无法删除多行,获取 "Some partition key parts are missing: identifier",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70953262/