Google Groups

Re: Data Modeling - JSON vs Composite columns

Michael Kjellman Sep 19, 2012 8:22 AM
Posted in group: NoSQL Databases
Client code. CQL will only deserialize composites as you mention in A.

On Sep 19, 2012, at 5:01 AM, "Roshni Rajagopal" <<>> wrote:


There was a conversation on this some time earlier, and to continue it

Suppose I want to associate a user to  an item, and I want to also store 3 commonly used attributes without needing to go to an entity item column family , I have 2 options :-

A) use composite columns
UserId1 : {
 <itemid1>:<Name> = Betty Crocker,
 <itemid1>:<Descr> = Cake
<itemid1>:<Qty> = 5
 <itemid2>:<Name> = Nutella,
 <itemid2>:<Descr> = Choc spread
<itemid2>:<Qty> = 15

B) use a json with the data
UserId1 : {
 <itemid1> = {name: Betty Crocker,descr: Cake, Qty: 5},
 <itemid2> ={name: Nutella,descr: Choc spread, Qty: 15}

Essentially A is better if one wants to update individual fields , while B is better if one wants easier paging, reading multiple items at once in one read. etc. The details are in this discussion thread

I had an additional question,
as its being said, that CQL is the direction in which cassandra is moving, and there's a lot of effort in making CQL the standard,

How does approach B work in CQL. Can we read/write a JSON easily in CQL? Can we extract a field from a JSON in CQL or would that need to be done via the client code?


'Like' us on Facebook for exclusive content and other resources on all Barracuda Networks solutions.