incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edward Capriolo <edlinuxg...@gmail.com>
Subject Re: Using CQL to insert a column to a row dynamically
Date Tue, 28 May 2013 14:01:23 GMT
Or just:
cli >
create column family ride_events with
comparator(Int32Type,Int32Type,Int32Type);


On Tue, May 28, 2013 at 4:45 AM, Tristan Seligmann
<mithrandi@mithrandi.net>wrote:

> On Mon, May 27, 2013 at 11:38 PM, Matthew Hillsborough <
> matthew.hillsborough@gmail.com> wrote:
>
>> Originally what I thought of doing was creating a column family in
>> Cassandra named `ride_events`. Each row key would be a rideID that's simply
>> an integer. I would then arbitrarily create columns with a name of the
>> following format:
>>
>> "EventID_5/Day_2/User_6" with a value of null.
>>
>
> You can accomplish the same thing with a CQL 3 schema like this:
>
> CREATE TABLE ride_events (
>   rideID int,
>   eventID int,
>   day int,
>   userID int,
>   dummy text,
>   PRIMARY KEY (rideID, eventID, day, userID));
>
> (I'm not sure if the `dummy` column is still required, it was last time I
> tried this).
>
> rideID will then be used as the partition key (underlying row key), while
> eventID / day / userID will be composited into the underlying storage
> engine column names.
>
> An example query against this schema might be:
>
> SELECT userID FROM ride_events WHERE rideID in (...) AND eventID = 5 AND
> day = 2;
> --
> mithrandi, i Ainil en-Balandor, a faer Ambar
>

Mime
View raw message