incubator-cassandra-user mailing list archives

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

Hi,
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 threadhttp://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Data-Modeling-another-question-td7581967.html
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?  
Regards,Roshni 		 	   		  
Mime
View raw message