views:

107

answers:

1

Hello,

I try to insert column with UUID1 keys to be able to sort them by date. I always get the error "cassandra.ttypes.InvalidRequestException: InvalidRequestException(why='UUIDs must be exactly 16 bytes')", and I don't know why.

Here is the code generating this error :

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()

What did I do wrong ? I use lazyboy 0.705 with Cassandra 0.6.4. The storage configuration is :

<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>
+1  A: 

The column name must be of uuid version 1. Looks like your key is a uuid version 1

Schildmeijer
Thank you so much :)
Pierre