Return-Path: Delivered-To: apmail-incubator-cassandra-user-archive@minotaur.apache.org Received: (qmail 95209 invoked from network); 24 Aug 2009 17:41:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Aug 2009 17:41:42 -0000 Received: (qmail 39700 invoked by uid 500); 24 Aug 2009 17:42:07 -0000 Delivered-To: apmail-incubator-cassandra-user-archive@incubator.apache.org Received: (qmail 39686 invoked by uid 500); 24 Aug 2009 17:42:07 -0000 Mailing-List: contact cassandra-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cassandra-user@incubator.apache.org Delivered-To: mailing list cassandra-user@incubator.apache.org Received: (qmail 39663 invoked by uid 99); 24 Aug 2009 17:42:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2009 17:42:07 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jbellis@gmail.com designates 74.125.78.146 as permitted sender) Received: from [74.125.78.146] (HELO ey-out-1920.google.com) (74.125.78.146) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2009 17:42:00 +0000 Received: by ey-out-1920.google.com with SMTP id 13so571681eye.54 for ; Mon, 24 Aug 2009 10:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=HPYsTkY4aauPt6N5wv+ruLJq6Cmzzx4urwTXosEHpOI=; b=AaOvZffyBd8yynrSL0ypnY6uqHtZ20EymeJ0un9gnupzhWhTormKQkK22woQcKVlY6 Ao9mc8LkrJNDMxa5uGcVquHrKk2uOkZnjxKzgRR1xvdVIOcGmk4SbglLW8Eo+AsY9P0t yapcN635eg6m8RE5kfOSKWbqfP0bvi4vW2tAE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=W7qqPMjn5O+vSEtfSoSGGm4l4Uz0ToheGchc1L/mEkneTv0ul//R0LfKxTWBntzq/Q RsgdN+ESeD8dg4Rzsj8kHjXi4FApWD1Mv7TwHNQtovXqoMID5AGnpRtpyyn6biObHLtl xNZBA3FeUYJoCFCTjP6CnWKAnaH2q5HR/LQbY= MIME-Version: 1.0 Received: by 10.216.11.84 with SMTP id 62mr818724wew.148.1251135698891; Mon, 24 Aug 2009 10:41:38 -0700 (PDT) In-Reply-To: References: Date: Mon, 24 Aug 2009 12:41:38 -0500 Message-ID: Subject: =?ISO-8859-1?Q?Re=3A_Newbe=B4s_question?= From: Jonathan Ellis To: cassandra-user@incubator.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org lazyboy works vs an earlier version of trunk, so it's already incompatible with 0.3, but not yet compatible w/ latest 0.4 :) On Mon, Aug 24, 2009 at 12:28 PM, Bruno Couto wrote: > Jonathan, > > > First, thanks for answering so fast. > I=B4m using version 0.3-final of Cassandra, then I believe the api > version 0.4 is not the problem, am I correct? > I'll look for the null problem. > > > Bruno Couto > > > On Mon, Aug 24, 2009 at 11:50 AM, Jonathan Ellis wrote= : >> There's two things going on here, I think. >> >> One is that you're passing a null where there shouldn't be one. =A0This >> is a thrift bug and will be addressed in the next beta. >> >> The other is that IIRC lazyboy needs to be updated to work with the >> latest 0.4 api. >> >> -Jonathan >> >> On Mon, Aug 24, 2009 at 9:09 AM, Bruno Couto wrote: >>> Hi Guys, >>> >>> my name is Bruno and I'm from Brazil, first, sorry for my bad english. >>> I'm in my first steps with cassandra, and I=B4m trying to use Lazyboy >>> (python wrapper). >>> But when I run the layzyboy columnfamily.py example, I get the >>> following error messages. >>> Someone with more experience could help me? >>> >>> Thanks, >>> >>> Bruno Couto. >>> >>> >>> ---- >>> >>> Cassandra Error Message: >>> >>> DEBUG - batch_insert >>> ERROR - Internal error processing batch_insert >>> java.lang.NullPointerException >>> =A0 =A0 =A0 =A0at org.apache.cassandra.db.RowMutation.getRowMutation(Ro= wMutation.java:284) >>> =A0 =A0 =A0 =A0at org.apache.cassandra.service.CassandraServer.batch_in= sert(CassandraServer.java:318) >>> =A0 =A0 =A0 =A0at org.apache.cassandra.service.Cassandra$Processor$batc= h_insert.process(Cassandra.java:968) >>> =A0 =A0 =A0 =A0at org.apache.cassandra.service.Cassandra$Processor.proc= ess(Cassandra.java:807) >>> =A0 =A0 =A0 =A0at org.apache.thrift.server.TThreadPoolServer$WorkerProc= ess.run(TThreadPoolServer.java:252) >>> =A0 =A0 =A0 =A0at java.util.concurrent.ThreadPoolExecutor$Worker.runTas= k(ThreadPoolExecutor.java:886) >>> =A0 =A0 =A0 =A0at java.util.concurrent.ThreadPoolExecutor$Worker.run(Th= readPoolExecutor.java:908) >>> =A0 =A0 =A0 =A0at java.lang.Thread.run(Thread.java:619) >>> DEBUG - Disseminating load info ... >>> >>> ---- >>> >>> Python Error Message: >>> >>> localhost ~ # python columnfamily.py >>> {'table': 'UserData', 'superkey': None, 'key': >>> '3a63b82a947d4ee1a8cbee45944b5dcb', 'family': 'Users', 'supercol': >>> None} >>> {'username': 'ieure', 'email': 'ian@digg.com'} >>> True >>> Traceback (most recent call last): >>> =A0File "columnfamily.py", line 65, in >>> =A0 =A0u.save() =A0 =A0 =A0 =A0 =A0 # -> {'username': 'ieure', 'email':= 'ian@digg.com'} >>> =A0File "/root/columnfamily.py", line 119, in save >>> >>> =A0File "build/bdist.linux-i686/egg/lazyboy/connection.py", line 106, i= n func >>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_= insert >>> >>> ---- >>> >>> ColumnFamily.py >>> >>> # -*- coding: utf-8 -*- >>> # >>> # Lazyboy examples >>> # >>> # =A9 2009 Digg, Inc. All rights reserved. >>> # Author: Ian Eure >>> # >>> # This example assumes the following schema: >>> # >>> # >>> # =A0 =A0 >>> # =A0 =A0 =A0 =A0 >>> # =A0 =A0
>>> #
>>> # >>> >>> >>> from lazyboy import * >>> >>> >>> # Define your cluster(s) >>> connection.add_pool('UserData', ['localhost:9160']) >>> >>> >>> # Subclass ColumnFamily to create an object of the correct type. >>> class User(columnfamily.ColumnFamily): >>> =A0 =A0"""A class representing a user in Cassandra.""" >>> >>> =A0 =A0# _key is the key template. It's values are given to >>> =A0 =A0# PrimaryKey.__init__ as keyword arguments any time a PK is >>> =A0 =A0# instantiated for this object. >>> =A0 =A0_key =3D {'table': 'UserData', =A0 =A0 =A0 =A0# The table to sto= re in >>> =A0 =A0 =A0 =A0 =A0 =A0'family': 'Users'} =A0 =A0 =A0 =A0 =A0# The Colu= mnFamily name to store on >>> >>> =A0 =A0# Anything in here _must_ be set before the object is saved >>> =A0 =A0_required =3D ('username',) >>> >>> >>> # Create an empty object >>> u =3D User() >>> >>> # A PrimaryKey is generated for you: >>> print u.pk >>> # -> {'table': 'UserData', 'superkey': None, >>> # =A0 =A0 'key': 'da6c8e19174f40cfa6d0b65a08eef62f', >>> # =A0 =A0 'family': 'Users', 'supercol': None} >>> >>> data =3D {'username': 'ieure', 'email': 'ian@digg.com'} >>> >>> # The object is a dict. All these are equivalent. >>> u.update(data) >>> u.update(data.items()) >>> u.update(**data) >>> for k in data: >>> =A0 =A0u[k] =3D data[k] >>> >>> # Arguments to __init__ are passed to update() >>> u =3D User(data) >>> print u =A0 =A0 =A0 =A0 =A0 =A0# -> {'username': 'ieure', 'email': 'ian= @digg.com'} >>> >>> # You can see if it's been modified. >>> print u.is_modified() =A0 =A0 =A0 =A0 =A0 # -> True >>> >>> # Save to Cassandra >>> u.save() =A0 =A0 =A0 =A0 =A0 # -> {'username': 'ieure', 'email': 'ian@d= igg.com'} >>> >>> print u.is_modified() =A0 =A0 =A0 =A0 =A0 # -> False >>> >>> # Load it in a new instance. >>> u_ =3D User().load(u.pk.key) >>> print u_ =A0 =A0 =A0 =A0 =A0 # -> {'username': 'ieure', 'email': 'ian@d= igg.com'} >>> >>> print u.is_modified() =A0 =A0 =A0 =A0 =A0 # -> False >>> del u['username'] >>> print u.valid() =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 # -> False >>> print u.missing() =A0 =A0 =A0 =A0 =A0 =A0 =A0 # -> ('username',) >>> try: >>> =A0 =A0u.save() =A0 =A0 =A0 =A0# -> ('Missing required field(s):', ('us= ername',)) >>> except Exception, e: >>> =A0 =A0print e >>> >>> # Discard modifications >>> u.revert() >>> print u.is_modified() =A0 =A0 =A0 =A0 =A0 # -> False >>> print u.valid() =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 # -> True >>> >> >