You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Matteo Caprari <ma...@gmail.com> on 2010/03/10 15:33:12 UTC

exception with python client

Hi.

On Cassandra 0.6 beta-2

I have this schema:
<Keyspace Name="KS">
<ColumnFamily Name="Users" CompareWith="BytesType"/>
<ColumnFamily Name="Items" CompareWith="BytesType" ColumnType="Super"
CompareSubcolumnsWith="BytesType"/>

I'm trying the batch_mutate api using python:

socket = TSocket.TSocket("localhost", 9160)
transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol.TBinaryProtocolAccelerated(transport)
client = Cassandra.Client(protocol)
transport.open()

m = {
    'exmpl_item_id': {
    'Items': [Mutation(ColumnOrSuperColumn(super_column=SuperColumn('users',[Column('name','matteo')])))]
}}
client.batch_mutate('KS', m, ConsistencyLevel.ONE)

I get an exception, but it's a shy one and can't figure out what is
that I'm doing wrong.

Thanks.

Traceback (most recent call last):
  File "test-migrate.py", line 23, in <module>
    client.batch_mutate('KS', m, ConsistencyLevel.ONE)
  File "/Users/dikappa/Documents/workspace/likelike/python/cassandra/Cassandra.py",
line 771, in batch_mutate
    self.recv_batch_mutate()
  File "/Users/dikappa/Documents/workspace/likelike/python/cassandra/Cassandra.py",
line 784, in recv_batch_mutate
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
  File "build/bdist.macosx-10.6-i386/egg/thrift/protocol/TBinaryProtocol.py",
line 126, in readMessageBegin
  File "build/bdist.macosx-10.6-i386/egg/thrift/protocol/TBinaryProtocol.py",
line 203, in readI32
  File "build/bdist.macosx-10.6-i386/egg/thrift/transport/TTransport.py",
line 58, in readAll
  File "build/bdist.macosx-10.6-i386/egg/thrift/transport/TTransport.py",
line 155, in read
  File "build/bdist.macosx-10.6-i386/egg/thrift/transport/TSocket.py",
line 94, in read
thrift.transport.TTransport.TTransportException: None




-- 
:Matteo Caprari
matteo.caprari@gmail.com

Re: exception with python client

Posted by Matteo Caprari <ma...@gmail.com>.
There was indeed a very clear message in the logs.
I was missing the timestamp in the Column declaration.

Thanks

On Wed, Mar 10, 2010 at 3:42 PM, Eric Evans <ee...@rackspace.com> wrote:
> On Wed, 2010-03-10 at 14:33 +0000, Matteo Caprari wrote:
>> I get an exception, but it's a shy one and can't figure out what is
>> that I'm doing wrong.
>>
>> Thanks.
>>
>> Traceback (most recent call last):
>>   File "test-migrate.py", line 23, in <module>
>>     client.batch_mutate('KS', m, ConsistencyLevel.ONE)
>>   File
>> "/Users/dikappa/Documents/workspace/likelike/python/cassandra/Cassandra.py",
>> line 771, in batch_mutate
>>     self.recv_batch_mutate()
>>   File
>> "/Users/dikappa/Documents/workspace/likelike/python/cassandra/Cassandra.py",
>> line 784, in recv_batch_mutate
>>     (fname, mtype, rseqid) = self._iprot.readMessageBegin()
>>   File
>> "build/bdist.macosx-10.6-i386/egg/thrift/protocol/TBinaryProtocol.py",
>> line 126, in readMessageBegin
>>   File
>> "build/bdist.macosx-10.6-i386/egg/thrift/protocol/TBinaryProtocol.py",
>> line 203, in readI32
>>   File
>> "build/bdist.macosx-10.6-i386/egg/thrift/transport/TTransport.py",
>> line 58, in readAll
>>   File
>> "build/bdist.macosx-10.6-i386/egg/thrift/transport/TTransport.py",
>> line 155, in read
>>   File "build/bdist.macosx-10.6-i386/egg/thrift/transport/TSocket.py",
>> line 94, in read
>> thrift.transport.TTransport.TTransportException: None
>
> I believe this simply means that the read didn't return a response.
> Start by checking the cassandra logs to see if there are any exceptions,
> and double check your connection parameters, network setup, etc.
>
> --
> Eric Evans
> eevans@rackspace.com
>
>



-- 
:Matteo Caprari
matteo.caprari@gmail.com

Re: exception with python client

Posted by Eric Evans <ee...@rackspace.com>.
On Wed, 2010-03-10 at 14:33 +0000, Matteo Caprari wrote:
> I get an exception, but it's a shy one and can't figure out what is
> that I'm doing wrong.
> 
> Thanks.
> 
> Traceback (most recent call last):
>   File "test-migrate.py", line 23, in <module>
>     client.batch_mutate('KS', m, ConsistencyLevel.ONE)
>   File
> "/Users/dikappa/Documents/workspace/likelike/python/cassandra/Cassandra.py",
> line 771, in batch_mutate
>     self.recv_batch_mutate()
>   File
> "/Users/dikappa/Documents/workspace/likelike/python/cassandra/Cassandra.py",
> line 784, in recv_batch_mutate
>     (fname, mtype, rseqid) = self._iprot.readMessageBegin()
>   File
> "build/bdist.macosx-10.6-i386/egg/thrift/protocol/TBinaryProtocol.py",
> line 126, in readMessageBegin
>   File
> "build/bdist.macosx-10.6-i386/egg/thrift/protocol/TBinaryProtocol.py",
> line 203, in readI32
>   File
> "build/bdist.macosx-10.6-i386/egg/thrift/transport/TTransport.py",
> line 58, in readAll
>   File
> "build/bdist.macosx-10.6-i386/egg/thrift/transport/TTransport.py",
> line 155, in read
>   File "build/bdist.macosx-10.6-i386/egg/thrift/transport/TSocket.py",
> line 94, in read
> thrift.transport.TTransport.TTransportException: None 

I believe this simply means that the read didn't return a response.
Start by checking the cassandra logs to see if there are any exceptions,
and double check your connection parameters, network setup, etc.

-- 
Eric Evans
eevans@rackspace.com


Re: exception with python client

Posted by Matteo Caprari <ma...@gmail.com>.
same error

On Wed, Mar 10, 2010 at 2:37 PM, Gary Dusbabek <gd...@gmail.com> wrote:
> On Wed, Mar 10, 2010 at 08:33, Matteo Caprari <ma...@gmail.com> wrote:
>
>> protocol = TBinaryProtocol.TBinaryProtocolAccelerated(transport)
>> client = Cassandra.Client(protocol)
>> transport.open()
>
> before attempting the mutation, try adding:
>
> client.transport = transport
>
> Gary.
>



-- 
:Matteo Caprari
matteo.caprari@gmail.com

Re: exception with python client

Posted by Gary Dusbabek <gd...@gmail.com>.
On Wed, Mar 10, 2010 at 08:33, Matteo Caprari <ma...@gmail.com> wrote:

> protocol = TBinaryProtocol.TBinaryProtocolAccelerated(transport)
> client = Cassandra.Client(protocol)
> transport.open()

before attempting the mutation, try adding:

client.transport = transport

Gary.