python - 在 Python 中为 Cassandra 生成 UUID

标签 python cassandra uuid pycassa

呵呵, 我正在使用

cf.insert(uuid.uuid1().bytes_le, {'column1': 'val1'}) (pycassa)

为 Cassandra 创建 TimeUUID,但出现错误

InvalidRequestException: 
InvalidRequestException(why='UUIDs must be exactly 16 bytes')

它不适用于

uuid.uuid1()
uuid.uuid1().bytes
str(uuid.uuid1())

要么。

创建有效 TimeUUID 以与 CompareWith="TimeUUIDType"标志一起使用的最佳方法是什么?

谢谢,
亨里克

最佳答案

看起来您正在使用 uuid 作为行键而不是列名。

compare_with: TimeUUIDType”属性指定列名将与使用 TimeUUIDType 进行比较,即 tells Cassandra how to sort the columns for slicing operations

您是否考虑过使用任何高级 Python 客户端?例如。 Tradedgy , Lazy Boy , TelephusPycassa

关于python - 在 Python 中为 Cassandra 生成 UUID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3240267/

相关文章:

ios - 在 MonoTouch 中生成并存储唯一 ID

go - 在golang中连接uuid

Python scrapy reddit 确认按钮中断抓取

cassandra - Docker 与 DataStax 连接无法正常工作

cassandra - Cassandra 中的查询将按特定字段对整个表进行排序

java - Cassandra 2.1 集群显示出持续较高的 CPU 使用率和缓慢的响应

python - 创建二进制字符串列表 (Python)

python - Django - ValueError : ModelState. 字段不能引用模型类 - "tags.to"可以。改用字符串引用

python - 如何使用神经网络预测峰值(最好在 python 中使用 neurolab 或 pybrain)

ios - 如何在运行时获取构建 UUID 和图像基地址