cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Cobley <>
Subject Re: using dynamic cell names in CQL 3
Date Mon, 29 Sep 2014 21:23:09 GMT
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>>,

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
update sensordata set data = data+{{date:'2012-10-2 12:12:30',name:'temp',value:5}} where
update sensordata set data = data+{{date:'2012-10-2 12:12:30',name:'humidity',value:31}} where

select * from sensordata;

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


On 29 Sep 2014, at 20:56, Robert Coli <<>>

On Thu, Sep 25, 2014 at 6:13 AM, shahab <<>>
It seems that I was not clear in my question, I would like to store values in the column name,
for example<> 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

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.


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

View raw message