cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Ancona <...@anconafamily.com>
Subject cassandra-cli: Create column family with composite column name
Date Wed, 05 Oct 2011 20:08:51 GMT
Using Cassandra 0.8.6, I've been trying to figure out how to use the
CLI to create column families using composite keys and column names.
The documentation on CompositeType seems pretty skimpy. But in the
course of writing this email to ask how to do it, I figured out the
proper syntax. In the hope of making it easier for the next person, I
repurposed this message to document what I figured out. I'll also
update the wiki. Here is the syntax:

create column family MyCF
    with key_validation_class = 'CompositeType(UTF8Type, IntegerType)'
    and comparator = 'CompositeType(DateType(reversed=true), UTF8Type)'
    and default_validation_class='CompositeType(UTF8Type, DateType)'
    and column_metadata=[
        { column_name:'0:my Column Name', validation_class:LongType,
index_type:KEYS}
    ];

One weakness of this syntax is that there doesn't seem to be a way to
escape a ':' in a composite value. There's a FIXME in the code to that
effect.

Jim

Mime
View raw message