【问题标题】:DataStax Enterprise 4.6.1 / C* Pagination in Python using cqlengine 0.21.0使用 cqlengine 0.21.0 在 Python 中的 DataStax Enterprise 4.6.1 / C* 分页
【发布时间】:2015-05-01 06:20:56
【问题描述】:

我目前正在尝试使用 Python 和 cqlengine 0.21.0 对来自 DSE 4.6.1 (Cassandra 2.0.12.200) 的查询结果进行分页。

我被查询的表是:

CREATE TABLE tags_for_search (
  village_id int,
  tag_prefix text,
  tag text,
  time timeuuid,
  author_id int,
  tag_id uuid,
  type text,
  PRIMARY KEY ((village_id, tag_prefix), tag, time)
) WITH CLUSTERING ORDER BY (time DESC) AND
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.100000 AND
  gc_grace_seconds=864000 AND
  index_interval=128 AND
  read_repair_chance=0.000000 AND
  populate_io_cache_on_flush='false' AND
  default_time_to_live=0 AND
  speculative_retry='99.0PERCENTILE' AND
  memtable_flush_period_in_ms=0 AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'LZ4Compressor'};

在 Python(使用 cqlengine 0.21.0)中是否有替代结果的分页/分页(DataStax Enterprise / DSE 4.6.1)?记录在案的解决方案 (http://cqlengine.readthedocs.org/en/latest/topics/queryset.html#token-function) 似乎由于 #7016 而被破坏。

我对数据的初始查询是:

SELECT * FROM that_keyspace.tags_for_search WHERE "tag_prefix" = 'der' AND "tag_text" = '#derpy1' AND "village_id" = 1 LIMIT 10000;

或者在 Python 中通过 cqlengine:

village_tags = VillageSearch.objects.filter(village_id=1, tag_prefix='der', tag_text='#derpy1')

tags_data = []
for village_tag in village_tags:
    tags_data.append(village_tag.to_dict())

first_page = village_tags
last = first_page[-1]
next_page = list(village_tags.filter(pk__token__gt=cqlengine.Token(last.pk)))

它正在抛出错误:

code=2200 [Invalid query] message="Column "village_id" cannot be restricted by both an equality and an inequality relation"

我是否可以使用替代方法来避免此错误以便立即使用?

感谢您提供的任何帮助!

【问题讨论】:

    标签: python pagination cassandra cql cqlengine


    【解决方案1】:

    此功能没有直接替代品。最好和最合适的答案是升级(现在这个错误修复可用)。

    将您的环境升级到 DSE >= 4.6.2 将解决此问题。

    【讨论】:

      猜你喜欢
      • 2015-08-25
      • 2015-01-20
      • 2015-01-22
      • 2015-01-09
      • 2017-06-03
      • 1970-01-01
      • 2015-03-15
      • 2023-03-20
      • 1970-01-01
      相关资源
      最近更新 更多