gpt4 book ai didi

python - cassandra 创建和使用索引 [pycassa]

转载 作者:行者123 更新时间:2023-12-01 06:01:23 24 4
gpt4 key购买 nike

我想在标准列族的“age”键上创建并使用索引。

我使用 pycassa 执行了以下操作:

In [10]: sys.create_index('test01', 'word_map', 'age', 'IntegerType', index_type=0, index_name='index_age')
In [11]: age_expr = create_index_expression('age', 6, GT)
In [12]: clause = create_index_clause([age_expr], count=20)
In [13]: cf.get_indexed_slices(clause)

error: 'No indexed columns present in index clause with operator EQ'

根据这个好page ,我需要设置值类型。但是:

In [16]:  cf_words.column_validators
Out[16]: {'black_white': 'BooleanType', 'url': 'UTF8Type', 'age': 'IntegerType', 'site': 'UTF8Type', 'len': 'IntegerType', 'content': 'UTF8Type', 'colourful': 'BooleanType', 'printer_friendly': 'BooleanType'}

所以年龄有一个数据类型集。

有什么想法吗?

最佳答案

使用pycassa.index.GT代替字符串“GT”。它是 Thrift 用整数实现的枚举。

您可以在此处找到所有文档和示例用法:http://pycassa.github.com/pycassa/api/pycassa/index.html

关于python - cassandra 创建和使用索引 [pycassa],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10237045/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com