gpt4 book ai didi

python - 在 Python 中为 Cassandra 生成 UUID

转载 作者:太空狗 更新时间:2023-10-29 18:27:00 25 4
gpt4 key购买 nike

呵呵,我正在使用

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/

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