Reputation: 20245
I want to store snapshots of an object in Apache Cassandra 1.2
Row key is the Object#ID and there will be a column for each snapshot.
-------- latest -------- v2 -------- v1
id-122 100 -------- 50 -------- 66
--------
So column names are created dynamically at runtime.
How to create the previous table in Cassandra 1.2 using CQL3?
Upvotes: 1
Views: 1140
Reputation: 3684
You would use the compound primary key feature of CQL3:
CREATE TABLE foo (
object_id int,
version int,
value int,
PRIMARY KEY (object_id, version));
Upvotes: 4
Reputation: 4792
In CQL3, Table schema is fixed. So you can't really get dynamic column names. For that you have to switch to CQL2.
Upvotes: 0