incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roshni Rajagopal <>
Subject Data Modeling - JSON vs Composite columns
Date Wed, 19 Sep 2012 12:00:34 GMT

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?  
View raw message