关于smaller-than
部件,不允许在DELETE
语句中的主键部件上使用它。
~ cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh:db_development> DELETE FROM users WHERE pk = 'jsmith' AND cc < 100 ;
code=2200 [Invalid query] message="Invalid operator < for PRIMARY KEY part cc"
cqlsh:db_development> DELETE FROM users WHERE pk = 'jsmith' AND cc = 100 ;
cqlsh:db_development>
该delete_all
方法确实创建了一个DELETE
语句。
这里是如何使用它:
irb(main):036:0> Users.where(pk: 'jsmith').where(cc: 100).delete_all
CQL (2ms) DELETE FROM users WHERE pk = 'jsmith' AND cc = 100
=> #<Cassandra::Result:0x3fdb891da8cc @rows=[] @last_page=true>
irb(main):037:0>
因为我在一个之后有更多的聚类列,所以cc
遍历cc
s 给了我一个比遍历 cc 下的其他每个聚类列更有效的解决方案。
github上的更多解释:https ://github.com/cequel/cequel/issues/237