Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 52995 invoked from network); 23 Sep 2010 02:33:09 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Sep 2010 02:33:09 -0000 Received: (qmail 18974 invoked by uid 500); 23 Sep 2010 02:33:07 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 18853 invoked by uid 500); 23 Sep 2010 02:33:05 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 18845 invoked by uid 99); 23 Sep 2010 02:33:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Sep 2010 02:33:05 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tshanky@gmail.com designates 74.125.82.172 as permitted sender) Received: from [74.125.82.172] (HELO mail-wy0-f172.google.com) (74.125.82.172) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Sep 2010 02:32:58 +0000 Received: by wyi11 with SMTP id 11so1279632wyi.31 for ; Wed, 22 Sep 2010 19:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=Lmb2I7CAjmZua+J9nyRYNsMYYN/A7CMcQ/3KwKAMT2c=; b=LX1M7YmbdTBHLMmnId58zp8gSviCYjLrSyZSwhroEj+h04IGVGETlf/IaYp/bXx7mS F6H/QXxwCDvGQJ+PbhtKYi84d40629Uta933i9BNb5wnIF0nlVp52qbGSlRcu7iMutuA gMKWp/aLPBVFzLzUuHnf4eI5rdZ/o4tGhjQc8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=ORQ7gV2RhZsZfe/n75oWvWdmx0lj38XnA3SjB8ADm2iY4bqQNUYbyYnO1Ct9AIdJgp igRhz3lOPIIDqu8Agr9O4higi5B/XHJSqBjqIwIdAMhuGLyQhnLLAjRF/AmSDHNV45TM cA9omHN8pbtDM4hH3hpBZLxHpW0aQhqtkz5uc= Received: by 10.216.17.130 with SMTP id j2mr7716243wej.47.1285209157863; Wed, 22 Sep 2010 19:32:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.232.39 with HTTP; Wed, 22 Sep 2010 19:32:17 -0700 (PDT) In-Reply-To: References: From: Shashank Tiwari Date: Wed, 22 Sep 2010 19:32:17 -0700 Message-ID: Subject: Re: Thrift gen problem with cassandra.thrift To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=0016e64c2ddc510bb60490e41379 X-Virus-Checked: Checked by ClamAV on apache.org --0016e64c2ddc510bb60490e41379 Content-Type: text/plain; charset=UTF-8 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 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 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 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 > > --0016e64c2ddc510bb60490e41379 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Jeremy and Aaron,
Thanks for your help.=C2=A0

= I had already installed Thrift on my Snow Leopard so I thought running =C2= =A0thrift -gen cassandra.thrift file would work. However as the wiki= suggests it appears only a specific version of Thrift work with a particul= ar 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&= #39;t straight forward and in fact its still throwing errors.

Aaron's suggestions of using the ant task (ant g= en-thrift-py)=C2=A0seemed much smoother but then that task does not gen= erate the python thrift module, it only generates the cassandra module.

So I used a mix and match of bo= th methods and finally have both the thrift and the cassandra modules. Howe= ver, it now seems there is a mismatch in the API. I ran the python example = from=C2=A0http://wiki.apache.org/cassandra/ThriftExamples#Python and ended up w= ith the following errors:

Traceback (most recent call last):
=C2= =A0=C2=A0File "cassandra_client.py", line 52, in <module>
=C2=A0=C2=A0 =C2=A0main()
=C2=A0=C2=A0File "cassand= ra_client.py", line 35, in main
=C2=A0=C2=A0 =C2=A0ConsistencyLevel.ZERO)
TypeError: insert(= ) takes exactly 5 arguments (7 given)

------=
Line 35 of cassandra_client.py is the same as line 35 of the pyt= hon example on the Cassandra wiki Thrift Examples page. Its the line in bol= d in the code snippet below:

=C2=A0=C2=A0 =C2=A0try:
=C2=A0=C2=A0 =C2= =A0 =C2=A0 =C2=A0transport.open()
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2= =A0#Insert the data into Keyspace 1
=C2=A0=C2=A0 =C2=A0 =C2=A0 = =C2=A0client.insert(keyspace,
=C2=A0=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0key,
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0column_path,
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0value,
=C2= =A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0timestamp,
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ConsistencyLevel.ZERO)
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0#Query for data
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0column_parent =3D ColumnParent(column= _family=3D"Standard1")
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2= =A0slice_range =3D SliceRange(start=3D"", finish=3D"")<= /div>
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0predicate =3D SlicePredicate(sli= ce_range=3Dslice_range)
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0result =3D client.get_slice(keyspace,=
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0key,
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0column_parent,
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0predicate,
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ConsistencyLevel.ONE)
=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0pp.pprint(result)
=C2=A0= =C2=A0 =C2=A0except Thrift.TException, tx:
=C2=A0=C2=A0 =C2=A0 = =C2=A0 =C2=A0print 'Thrift: %s' % tx.message
=C2=A0=C2=A0= =C2=A0finally:

Can somebody please help and make sense of this. = Isn't there a more simple and straightforward way getting Thrift to wor= k with Cassandra? If not, why not?

Thanks, Shashan= k


On Wed, Sep 22, 2010 at 1:16 PM, Aaron M= orton <aaro= n@thelastpickle.com> wrote:
Aaron
=
=C2=A0

On 22 Sep, 2010,at 07:35 PM, Sha= shank Tiwari <tsh= anky@gmail.com> wrote:

<= div>
I installed thrift successfully on Snow Leaopard. However, when I run=C2=A0=
thrift -gen java interface/cassandra.thrift with Cassandr= a 0.6.5, I get an error which reads as follows:
....apache-cassan= dra-0.6.5/interface/cassandra.thrift:303] error: identifier ONE is unqualif= ied!
Line 303 of cassandra.thrift is highlighted in the text below:

296 =C2=A0 /**
297 =C2=A0 =C2=A0 Get the C= olumn or SuperColumn at the given column_path. If no value is present, NotF= oundException is thrown =C2=A0 =C2=A0. (This is
298 =C2=A0 =C2=A0 the only method that can throw an exception under no= n-failure conditions)
299 =C2=A0 =C2=A0*/
300 =C2=A0 Co= lumnOrSuperColumn get(1:required string keyspace,
301 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 2:required string key,
302 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 3:required ColumnPath column_path,
30= 3 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 4:required ConsistencyLevel consistency_level=3DONE)<= /div>
304 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 throws (1:InvalidRequestException ire, 2:NotFoundExceptio= n nfe, 3:UnavailableException ue =C2=A0 =C2=A0, 4:TimedOutException te),
305=C2=A0

Could somebody please help re= solve this problem and also explain what's going on here.
Thanks, Shashank

--0016e64c2ddc510bb60490e41379--