Isn’t the correct way to do this in CQL3 to use sets and user defined types (in 
C* 2.1) ?:

create type sensorreading( date timestamp, name text, value int);
CREATE TABLE sensordata (
name text,
data set<frozen <sensorreading>>,
PRIMARY KEY (name)
);

insert into keyspace2.sensordata (name, data) values ('1234', {{date:'2012-10-2 
12:10',name:'temp',value:4}});
update sensordata set data = data+{{date:'2012-10-2 
12:10',name:'humidity',value:30}} where name='1234';
update sensordata set data = data+{{date:'2012-10-2 
12:12:30',name:'temp',value:5}} where name='1234';
update sensordata set data = data+{{date:'2012-10-2 
12:12:30',name:'humidity',value:31}} where name='1234';

select * from sensordata;


Perhaps not what you are after, but may be a start ?

Andy



On 29 Sep 2014, at 20:56, Robert Coli 
<rc...@eventbrite.com<mailto:rc...@eventbrite.com>> wrote:

On Thu, Sep 25, 2014 at 6:13 AM, shahab 
<shahab.mok...@gmail.com<mailto:shahab.mok...@gmail.com>> wrote:
It seems that I was not clear in my question, I would like to store values in 
the column name, for example column.name<http://column.name/> would be 
event_name ("temperature") and column-content would be the respective value 
(e.g. 40.5) . And I need to know how the schema should look like in CQL 3

You cannot have dynamic column names, in the exact storage way you are thinking 
of them, in CQL3.

You can have a simple E-A-V scheme which works more or less the same way. It is 
less storage efficient, but you get the CQL interface. In the opinion of the 
developers, this was an acceptable tradeoff. In most cases, it probably is.

In other cases, I would recommend using thrift and actual dynamic columns... 
except that I logically presume Thrift will be eventually be deprecated. I am 
unable to recommend the use of a feature which I believe will eventually be 
removed from the product.

=Rob


The University of Dundee is a registered Scottish Charity, No: SC015096

Reply via email to