incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shashank Tiwari <tsha...@gmail.com>
Subject Re: Thrift gen problem with cassandra.thrift
Date Thu, 23 Sep 2010 18:48:16 GMT
I finally grabbed Cassandra off the trunk to make things work so I guess it
is 0.7. If I start the same server and connect to it, should things work? I
am happy using pycassa or telephus but I had Thrift installed for things
beyond Cassandra (for example for Hypertable) and I was hoping that
installation would work with multiple products that use Thrift. Now I know
it doesn't.

Thanks, Shashank

On Thu, Sep 23, 2010 at 10:17 AM, Tyler Hobbs <tyler@riptano.com> wrote:

> Is it possible that you are somehow using the 0.7 generated cassandra
> module, perhaps from some previous installation of a client library?  In
> 0.7, insert takes only 5 arguments.
>
> Also, is there any particular reason that you are using raw Thrift and not
> a high level client like pycassa, telephus, etc?
>
> - Tyler
>
>
>
> On Wed, Sep 22, 2010 at 9:32 PM, Shashank Tiwari <tshanky@gmail.com>wrote:
>
>> Jeremy and Aaron,
>> Thanks for your help.
>>
>> I had already installed Thrift on my Snow Leopard so I thought running  *thrift
>> -gen cassandra.thrift* file would work. However as the wiki suggests it
>> appears only a specific version of Thrift work with a particular Cassandra
>> version. So I checked out the matching version of Thrift. Even after getting
>> the exact version of Thrift though, getting it to work wasn't straight
>> forward and in fact its still throwing errors.
>>
>> Aaron's suggestions of using the ant task (*ant gen-thrift-py*) seemed
>> much smoother but then that task does not generate the python thrift module,
>> it only generates the cassandra module.
>>
>> So I used a mix and match of both methods and finally have both the thrift
>> and the cassandra modules. However, it now seems there is a mismatch in the
>> API. I ran the python example from
>> http://wiki.apache.org/cassandra/ThriftExamples#Python and ended up with
>> the following errors:
>>
>> Traceback (most recent call last):
>>   File "cassandra_client.py", line 52, in <module>
>>     main()
>>   File "cassandra_client.py", line 35, in main
>>     ConsistencyLevel.ZERO)
>> TypeError: insert() takes exactly 5 arguments (7 given)
>>
>> ------
>> Line 35 of cassandra_client.py is the same as line 35 of the python
>> example on the Cassandra wiki Thrift Examples page. Its the line in bold in
>> the code snippet below:
>>
>>     try:
>>         transport.open()
>>         #Insert the data into Keyspace 1
>>         *client.insert(keyspace,*
>> *                      key,*
>> *                      column_path,*
>> *                      value,*
>> *                      timestamp,*
>> *                      ConsistencyLevel.ZERO)*
>>         #Query for data
>>         column_parent = ColumnParent(column_family="Standard1")
>>         slice_range = SliceRange(start="", finish="")
>>         predicate = SlicePredicate(slice_range=slice_range)
>>         result = client.get_slice(keyspace,
>>                                   key,
>>                                   column_parent,
>>                                   predicate,
>>                                   ConsistencyLevel.ONE)
>>         pp.pprint(result)
>>     except Thrift.TException, tx:
>>         print 'Thrift: %s' % tx.message
>>     finally:
>>
>> Can somebody please help and make sense of this. Isn't there a more simple
>> and straightforward way getting Thrift to work with Cassandra? If not, why
>> not?
>>
>> Thanks, Shashank
>>
>>
>> On Wed, Sep 22, 2010 at 1:16 PM, Aaron Morton <aaron@thelastpickle.com>wrote:
>>
>>> I normally get the source download, then run ant gen-thrift-py
>>>
>>> Is there a reason you want to build it manually?
>>>
>>> Aaron
>>>
>>>
>>> On 22 Sep, 2010,at 07:35 PM, Shashank Tiwari <tshanky@gmail.com> wrote:
>>>
>>> I installed thrift successfully on Snow Leaopard. However, when I run
>>> *thrift -gen java interface/cassandra.thrift* with Cassandra 0.6.5, I
>>> get an error which reads as follows:
>>> ....apache-cassandra-0.6.5/interface/cassandra.thrift:303] error:
>>> identifier ONE is unqualified!
>>> Line 303 of cassandra.thrift is highlighted in the text below:
>>>
>>> 296   /**
>>> 297     Get the Column or SuperColumn at the given column_path. If no
>>> value is present, NotFoundException is thrown    . (This is
>>> 298     the only method that can throw an exception under non-failure
>>> conditions)
>>> 299    */
>>> 300   ColumnOrSuperColumn get(1:required string keyspace,
>>> 301                           2:required string key,
>>> 302                           3:required ColumnPath column_path,
>>> *303                           4:required ConsistencyLevel
>>> consistency_level=ONE)*
>>> 304                       throws (1:InvalidRequestException ire,
>>> 2:NotFoundException nfe, 3:UnavailableException ue    , 4:TimedOutException
>>> te),
>>> 305
>>>
>>> Could somebody please help resolve this problem and also explain what's
>>> going on here.
>>>
>>> Thanks, Shashank
>>>
>>>
>>
>

Mime
View raw message