Python 与卡桑德拉和懒汉在一起的时光

Python 与卡桑德拉和懒汉在一起的时光,python,cassandra,uuid,Python,Cassandra,Uuid,我尝试插入带有UUID1键的列,以便能够按日期对它们进行排序。我总是收到错误“cassandra.ttypes.InvalidRequestException:InvalidRequestException(为什么='UUIDs必须正好是16字节')”,我不知道为什么 以下是生成此错误的代码: from lazyboy import * from lazyboy.key import Key import uuid class TestItemKey(Key): def __init_

我尝试插入带有UUID1键的列,以便能够按日期对它们进行排序。我总是收到错误“cassandra.ttypes.InvalidRequestException:InvalidRequestException(为什么='UUIDs必须正好是16字节')”,我不知道为什么

以下是生成此错误的代码:

from lazyboy import *
from lazyboy.key import Key
import uuid

class TestItemKey(Key):
    def __init__(self, key=None):
        Key.__init__(self, 'MXstore', 'TestCF', key)

class TestItem(record.Record):
    def __init__(self, *args, **kwargs):
        record.Record.__init__(self, *args, **kwargs)
        self.key = TestItemKey(uuid.uuid1().bytes)

connection.add_pool('MXstore', ['localhost:9160'])

tmp = {'foo' : 'bar'}
tmps = TestItem(tmp).save()
我做错了什么?我使用lazyboy 0.705和Cassandra 0.6.4。 存储配置为:

<Keyspaces>
    <Keyspace Name="MXstore">
        <ColumnFamily Name="TestCF" CompareWith="TimeUUIDType" />

        <ReplicaPlacementStrategy>org.apache.cassandra.locator.RackUnawareStrategy</ReplicaPlacementStrategy>
        <ReplicationFactor>3</ReplicationFactor>
        <EndPointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndPointSnitch>
    </Keyspace>
</Keyspaces>

org.apache.cassandra.locator.rackunawarestegy
3.
org.apache.cassandra.locator.EndPointSnitch

列名必须为uuid版本1。看起来您的密钥是uuid版本1

列名必须是uuid版本1。看起来您的密钥是uuid版本1

uuid.uuid1().bytes的长度是多少?len(uuid.uuid1().bytes)=16,type(uuid.uuid1().bytes)=。我猜是16个字节。uuid.uuid1().bytes的长度是多少?len(uuid.uuid1().bytes)=16,type(uuid.uuid1().bytes)=。16个字节,我想这是意料之中的。