The first question is how you need to access this data. Do you need to directly 
access “bar” from a SELECT? Do you need to access “foo” as... what – Java Map, 
or what?

That said, you can always flatten a map of maps by simply concatenating the 
keys, such as {“foo_bar”: “hello”} and then you can select ‘foo_bar’. Ditto for 
additional levels. And if you want each of the intermediate levels, pick a 
serialization format such as JSON or BSON in addition to the flattened leaf 
values. Anything in your use case(s) that doesn’t cover?

-- Jack Krupansky

From: Kevin Burton 
Sent: Friday, June 13, 2014 8:17 PM
To: user@cassandra.apache.org 
Subject: Pattern to store maps of maps...

So the cassandra map support in CQL is nice but it's got me wanting deeper 
nesting. 

For example { "foo": { "bar": "hello" } }

… but that's not possible with CQL.

Of course… one solution is something like avro, and then store your entire 
record as a blob.

I guess that's not TOO bad but that means all my data is somewhat opaque to 
cqlsh.

What are my options here?  What are you guys doing to work around this problem?

-- 


Founder/CEO Spinn3r.com

Location: San Francisco, CA
Skype: burtonator
blog: http://burtonator.wordpress.com
… or check out my Google+ profile

War is peace. Freedom is slavery. Ignorance is strength. Corporations are 
people.

Reply via email to