Question

I inserted the data like this.

import pycassa, datetime
cf.insert(pycassa.util.convert_time_to_uuid(datetime.datetime.now()),{str(i): 'val'})

......

data

dbed33be-cc9e-11e1-8080-808080808080 OrderedDict([('column1', 'val1')])

How to get the data with uuid key?

I tried to get the data like this.

cf.get("UUID('dbed33be-cc9e-11e1-8080-808080808080')")
cf.get("dbed33be-cc9e-11e1-8080-808080808080")
cf.get(UUID('dbed33be-cc9e-11e1-8080-808080808080'))

But, I didn't get.

Was it helpful?

Solution

You were really close to the solution, but yet so far away..


pycassa.util.convert_time_to_uuid will return a value of type uuid.UUID, to generate one from a string (as you've tried) you will need to use either of the below methods:

UUID('{12345678-1234-5678-1234-567812345678}')

UUID('12345678123456781234567812345678')

UUID('urn:uuid:12345678-1234-5678-1234-567812345678')

cf.get(UUID('{dbed33be-cc9e-11e1-8080-808080808080}')) # example

Read more about UUID under the following link:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top