Return-Path: Delivered-To: apmail-incubator-cassandra-user-archive@minotaur.apache.org Received: (qmail 39749 invoked from network); 24 Aug 2009 16:56:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Aug 2009 16:56:09 -0000 Received: (qmail 27398 invoked by uid 500); 24 Aug 2009 14:09:54 -0000 Delivered-To: apmail-incubator-cassandra-user-archive@incubator.apache.org Received: (qmail 27382 invoked by uid 500); 24 Aug 2009 14:09:54 -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 27373 invoked by uid 99); 24 Aug 2009 14:09:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2009 14:09:54 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bcouto@gmail.com designates 209.85.212.192 as permitted sender) Received: from [209.85.212.192] (HELO mail-vw0-f192.google.com) (209.85.212.192) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2009 14:09:46 +0000 Received: by vws30 with SMTP id 30so1994272vws.21 for ; Mon, 24 Aug 2009 07:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=KQ2zfxl1mkNbtIxuWleVJnnpkWS5RXOY9lu1OGF94rM=; b=RexSZNZofaetd6WeOy+8M0CliTka7OCMK8faMQLl3oHpS58eoEMCglNS9nLZtJCjiQ xJLTqyrFa/0C+Zdc8n+uLHt57paM/WH/+vvKFpYZ2CKRSODtVitKvVRHitykFf4jEsHr 6KWZNfioUIbxLdKAgmx6Chjf7cgMIEKADEvII= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=ZZ7STaImH8ZZ/mdstfRv7AX2uaS1bQvwW0luGVgTSu13e3FaWs6F/ib+erkTeAvaJA ZxD7MX/MZQyke+1d6JCOc+9M4eblcCC+JT5/1cfIRAnF39Jk3Qv6NehkwPtXlKnETB5b UQb6n+kuFoizkXC8QkLx6wiKQLDaaHC3YIhdY= MIME-Version: 1.0 Received: by 10.150.42.1 with SMTP id p1mr4429949ybp.15.1251122964066; Mon, 24 Aug 2009 07:09:24 -0700 (PDT) Date: Mon, 24 Aug 2009 11:09:24 -0300 Message-ID: Subject: =?ISO-8859-1?Q?Newbe=B4s_question?= From: Bruno Couto 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 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 at org.apache.cassandra.db.RowMutation.getRowMutation(RowMutation.j= ava:284) at org.apache.cassandra.service.CassandraServer.batch_insert(Cassan= draServer.java:318) at org.apache.cassandra.service.Cassandra$Processor$batch_insert.pr= ocess(Cassandra.java:968) at org.apache.cassandra.service.Cassandra$Processor.process(Cassand= ra.java:807) at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TTh= readPoolServer.java:252) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoo= lExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExe= cutor.java:908) at 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): File "columnfamily.py", line 65, in u.save() # -> {'username': 'ieure', 'email': 'ian@digg.com'} File "/root/columnfamily.py", line 119, in save File "build/bdist.linux-i686/egg/lazyboy/connection.py", line 106, in fun= c lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_inse= rt ---- ColumnFamily.py # -*- coding: utf-8 -*- # # Lazyboy examples # # =A9 2009 Digg, Inc. All rights reserved. # Author: Ian Eure # # This example assumes the following schema: # # # # #
#
# 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): """A class representing a user in Cassandra.""" # _key is the key template. It's values are given to # PrimaryKey.__init__ as keyword arguments any time a PK is # instantiated for this object. _key =3D {'table': 'UserData', # The table to store in 'family': 'Users'} # The ColumnFamily name to store on # Anything in here _must_ be set before the object is saved _required =3D ('username',) # Create an empty object u =3D User() # A PrimaryKey is generated for you: print u.pk # -> {'table': 'UserData', 'superkey': None, # 'key': 'da6c8e19174f40cfa6d0b65a08eef62f', # '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: u[k] =3D data[k] # Arguments to __init__ are passed to update() u =3D User(data) print u # -> {'username': 'ieure', 'email': 'ian@digg.com'} # You can see if it's been modified. print u.is_modified() # -> True # Save to Cassandra u.save() # -> {'username': 'ieure', 'email': 'ian@digg.com'} print u.is_modified() # -> False # Load it in a new instance. u_ =3D User().load(u.pk.key) print u_ # -> {'username': 'ieure', 'email': 'ian@digg.com'} print u.is_modified() # -> False del u['username'] print u.valid() # -> False print u.missing() # -> ('username',) try: u.save() # -> ('Missing required field(s):', ('username',)) except Exception, e: print e # Discard modifications u.revert() print u.is_modified() # -> False print u.valid() # -> True