cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Anecito <>
Subject Intresting issue with getting Order By to work...
Date Wed, 31 Jul 2013 05:12:48 GMT
Hi All,

I am trying to have a table that I can have a key for one CQL to get a row based on a key
and another CQL to where I have a list of keys using the "IN" keyword and have an ORDER BY
clause. The data I am getting is from the Column value not the Column Name. The issue I am
having is trying to setup the column family to achieve this. I have this cli command to create
the column family but when I go do an insert I get a odd exception about the Primary key.
Below is the cli and the error when doing the insert of column values after the column family
was created.

The cli command used to create the column family:

create column family video_item_details 
with key_validation_class = 'CompositeType(IntegerType,UTF8Type)'
and comparator = 'UTF8Type'
and column_metadata = [
{column_name : key, validation_class: IntegerType, index_type: KEYS}
{column_name : name, validation_class : 'UTF8Type', index_type: KEYS}
{column_name : description, validation_class :'UTF8Type'}
{column_name : url, validation_class : 'UTF8Type'}
{column_name : play_time, validation_class : 'UTF8Type'}
{column_name : type, validation_class : 'UTF8Type'}
with caching='ALL';

the error during insert is:

Error while inserting com.datastax.driver.core.exceptions.InvalidQueryException: Missing mandatory
PRIMARY KEY part key2

The insert statement that was being attempted to be executed was:

INSERT INTO video.video_item_details(key, name, description, url, play_time, type) values(1,'Gettysburg','Gettysburg
Movie Trailer','http://localhost/test.avi','2:53','Streaming')

>From the links sent to me and the examples googling I have found only cli comands using
CompositeType for comparitor and not validator and also for only one Primary Key and not a
Compound Primary key using CompositeType. Thus I am stuck on something I feel should be a
standard thing to do with a column family but no working examples.

Thanks for any advice on how to get Cassandra to do this type of query.

Best Regards,
View raw message