cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vivek Mishra <mishra.v...@gmail.com>
Subject Re: Using compound primary key
Date Tue, 09 Oct 2012 03:12:50 GMT
Hi Brian,
Thanks for these references. These will surly help as i am on my way to get
them integrate with-in Kundera.

Surprisingly Column family itself was not created with example i was trying.

Thanks again,
-Vivek

On Tue, Oct 9, 2012 at 8:33 AM, Brian O'Neill <bone@alumni.brown.edu> wrote:

> Hey Vivek,
>
> The same thing happened to me the other day.  You may be missing a
> component in your compound key.
>
> See this thread:
>
> http://mail-archives.apache.org/mod_mbox/cassandra-dev/201210.mbox/%3CCAJHHpg20RRcAJqJDNF8SF7wnhbLo6j+AOFKsgbxyXwcOocG6oA@mail.gmail.com%3E
>
> I also wrote a couple blogs on it:
>
> http://brianoneill.blogspot.com/2012/09/composite-keys-connecting-dots-between.html
>
> http://brianoneill.blogspot.com/2012/10/cql-astyanax-and-compoundcomposite-keys.html
>
> They've fixed this in the 1.2 beta, whereby it checks (at the thrift
> layer) to ensure you have the requisite number of components in the
> compound/composite key.
>
> -brian
>
>
> On Oct 8, 2012, at 10:32 PM, Vivek Mishra wrote:
>
> Certainly. As these are available with cql3 only!
> Example mentioned on datastax website is working fine, only difference is
> i tried with a compound primary key with 3 composite columns in place of 2
>
> -Vivek
>
> On Tue, Oct 9, 2012 at 7:57 AM, Arindam Barua <abarua@247-inc.com> wrote:
>
>>  ** **
>>
>> Did you use the “--cql3” option with the cqlsh command?****
>>
>> ** **
>>
>> *From:* Vivek Mishra [mailto:mishra.vivs@gmail.com]
>> *Sent:* Monday, October 08, 2012 7:22 PM
>> *To:* user@cassandra.apache.org
>>
>> *Subject:* Using compound primary key****
>>
>> ** **
>>
>> Hi,****
>>
>> ** **
>>
>> I am trying to use compound primary key column name and i am referring to:
>> ****
>>
>> http://www.datastax.com/dev/blog/whats-new-in-cql-3-0****
>>
>> ** **
>>
>> As mentioned on this example, i tried to create a column family
>> containing compound primary key (one or more) as:****
>>
>> ** **
>>
>>  CREATE TABLE altercations (****
>>
>>        instigator text,****
>>
>>        started_at timestamp,****
>>
>>        ships_destroyed int,****
>>
>>        energy_used float,****
>>
>>        alliance_involvement boolean,****
>>
>>        PRIMARY KEY (instigator,started_at,ships_destroyed)****
>>
>>    );****
>>
>> ** **
>>
>> And i am getting:****
>>
>> ** **
>>
>> *************************************************************************
>> *
>>
>> TSocket read 0 bytes****
>>
>> cqlsh:testcomp> ****
>>
>> *************************************************************************
>> *
>>
>> ** **
>>
>> ** **
>>
>> Then followed by insert and select statements giving me following errors:
>> ****
>>
>> ** **
>>
>>
>> ********************************************************************************************************************************************
>> ****
>>
>> ** **
>>
>> cqlsh:testcomp>    INSERT INTO altercations (instigator, started_at,
>> ships_destroyed,****
>>
>>             ...                              energy_used,
>> alliance_involvement)****
>>
>>             ...                      VALUES ('Jayne Cobb', '2012-07-23',
>> 2, 4.6, 'false');****
>>
>> TSocket read 0 bytes****
>>
>> ** **
>>
>> cqlsh:testcomp> select * from altercations;****
>>
>> Traceback (most recent call last):****
>>
>>   File "bin/cqlsh", line 1008, in perform_statement****
>>
>>     self.cursor.execute(statement, decoder=decoder)****
>>
>>   File
>> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", line
>> 117, in execute****
>>
>>     response = self.handle_cql_execution_errors(doquery, prepared_q,
>> compress)****
>>
>>   File
>> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", line
>> 132, in handle_cql_execution_errors****
>>
>>     return executor(*args, **kwargs)****
>>
>>   File
>> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py",
>> line 1583, in execute_cql_query****
>>
>>     self.send_execute_cql_query(query, compression)****
>>
>>   File
>> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py",
>> line 1593, in send_execute_cql_query****
>>
>>     self._oprot.trans.flush()****
>>
>>   File
>> "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TTransport.py",
>> line 293, in flush****
>>
>>     self.__trans.write(buf)****
>>
>>   File
>> "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TSocket.py",
>> line 117, in write****
>>
>>     plus = self.handle.send(buff)****
>>
>> error: [Errno 32] Broken pipe****
>>
>> ** **
>>
>> cqlsh:testcomp> ****
>>
>> ** **
>>
>>
>> ********************************************************************************************************************************************
>> ****
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>> Any idea?  Is it a problem with CQL3 or with cassandra?****
>>
>> ** **
>>
>> P.S: I did post same query on dev group as well to get a quick response.*
>> ***
>>
>> ** **
>>
>> ** **
>>
>> -Vivek****
>>
>
>
> --
> Brian ONeill
> Lead Architect, Health Market Science (http://healthmarketscience.com)
> mobile:215.588.6024
> blog: http://weblogs.java.net/blog/boneill42/
> blog: http://brianoneill.blogspot.com/
>
>

Mime
View raw message