OK, so great news, it is now possible to do in CQL with the following syntax, as per CASSANDRA-4179
CREATE TABLE foo ( host text, service text, metric int, PRIMARY KEY ((host,service))); (note the double parentheses). This will effectively create a CF whose row key is a composite type. Thanks for getting this in 1.2 ! - pyr On Mon, Dec 24, 2012 at 2:17 PM, Manu Zhang <[email protected]> wrote: > CREATE TABLE seen_ships ( >> day text, >> time_seen timestamp, >> shipname text, >> PRIMARY KEY (day, time_seen) >> ); > > > In CQL3, we could select all the columns with the same 'day' and same > 'time_seen'. > > Is it possible with cassandra-cli? > > > On Mon, Dec 24, 2012 at 6:54 AM, Tristan Seligmann < > [email protected]> wrote: > >> On Sun, Dec 23, 2012 at 9:25 PM, aaron morton <[email protected]> >> wrote: >> > In this example: >> > >> > CREATE TABLE seen_ships ( >> > day text, >> > time_seen timestamp, >> > shipname text, >> > PRIMARY KEY (day, time_seen) >> > ); >> > http://www.datastax.com/dev/blog/whats-new-in-cql-3-0 >> > >> > * day is the internal row key >> > * there is only ONE internal column / cell, the shipname >> > * the internal column / cell "shipname" is a composite of the *value* of >> > time_seen. e.g. <time_seen:shipnae> >> >> Alternatively, if you want a composite partition key eg. >> <day:time_seen>, this functionality is implemented in >> https://issues.apache.org/jira/browse/CASSANDRA-4179 and I believe is >> available in Cassandra 1.2 as well[1]. >> >> [1] I recently asked about this on SO: >> >> http://stackoverflow.com/questions/13938288/can-a-cassandra-cql3-column-family-have-a-composite-partition-key >> -- >> mithrandi, i Ainil en-Balandor, a faer Ambar >> > >
