MANISH ZOPE
MANISH ZOPE

Reputation: 1201

How to read the uuid4 objects in human readable format in cqlsh - cassandra

When I am trying to read uuid4 type column from the cassandra I am getting garbage. Is there any way to read it in human readable format (hex-string format representing the uuid4 objects)

Here is what I am getting -

cqlsh:upgradetest> select *  from "AccessControlLinks" where key =   'a471b42b-cb20-4ae2-b924-c79a5eec1bed-Filters';

key                                          |     column1                                           | value

a471b42b-cb20-4ae2-b924-c79a5eec1bed-Filters | G\xff\xbc\x01\xaadNp\xb6\xd9\xe2\xd9\x0e\xd1\xc5@ |      

Is there any cqlsh function / some flag I need to set to get the value of column1 in human readable format?

Thanks in Advance

Manish

Upvotes: 1

Views: 522

Answers (2)

MANISH ZOPE
MANISH ZOPE

Reputation: 1201

There is no easy way to read the uuid string through cqlsh when data in cassandra is in compressed format. But there is a work around in python. Just mentioning if people faced same issue.

Here is how it can be done. Go to python promt

import uuid
uuid.UUID(bytes='\xec\x84\x9e\xfd\x83\x83N6\x9b\xcd\xa4<{\x8a\xda\xd9')

i.e. pass string from cqlsh to uuid.UUID

Upvotes: 0

Andy Tolbert
Andy Tolbert

Reputation: 11638

The issue you are having is that you are using compact storage (thrift tables) so you are losing out on the benefits of CQL and your column values are going to simply be blobs.

Is there a reason you are using compact storage? Are you still using thrift for your data transport or have you chosen compact storage for another reason?

I don't believe there will an easy way for you to read the data in a non-binary format with cqlsh.

Upvotes: 2

Related Questions