【问题标题】:cql query in operator with composite key with zipped list带有压缩列表的复合键的运算符中的 cql 查询
【发布时间】:2020-10-26 04:56:24
【问题描述】:

我正在尝试将压缩列表传递给 cassandra 的 cql 查询。

假设我的复合键是 (value1, value2)

这是我想做的事情(我知道它不起作用,但希望这能解释它)

zippedlist = zip(value1list, value2list)

Select * from table where value1 and value2 in zippedlist

目前我会让每个键都有一个带有列表的 in 运算符(这会起作用,但我需要选择查询作为我的压缩列表中的集合(需要选择特定的组合)。有什么想法吗?

【问题讨论】:

    标签: python cassandra cql


    【解决方案1】:

    不,CQL 中没有这样的东西。但总的来说,对分区键的IN 查询是个坏主意——它给协调节点等增加了更多压力(参见this answer for more details)。

    我建议只发送len(zippedlist) 异步查询,并在客户端收集数据。 documentation,甚至有一个例子,你可以按原样使用......

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-22
      • 2012-08-04
      • 2018-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-16
      • 2012-11-08
      相关资源
      最近更新 更多