You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Bruno Couto <bc...@gmail.com> on 2009/08/24 16:09:24 UTC

Newbe´s question

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´m 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.java:284)
        at org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
        at org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
        at org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
    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 func
lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_insert

----

ColumnFamily.py

# -*- coding: utf-8 -*-
#
# Lazyboy examples
#
# © 2009 Digg, Inc. All rights reserved.
# Author: Ian Eure <ia...@digg.com>
#
# This example assumes the following schema:
#
# <Tables>
#     <Table Name="UserData">
#         <ColumnFamily ColumnSort="Name" Name="Users"/>
#     </Table>
# </Tables>
#


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 = {'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 = ('username',)


# Create an empty object
u = User()

# A PrimaryKey is generated for you:
print u.pk
# -> {'table': 'UserData', 'superkey': None,
#     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
#     'family': 'Users', 'supercol': None}

data = {'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] = data[k]

# Arguments to __init__ are passed to update()
u = 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_ = 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

Re: Newbe´s question

Posted by Jonathan Ellis <jb...@gmail.com>.
the problem is README changes far too infrequently from the pov of
someone who just uses official releases.

we have a list here: http://wiki.apache.org/cassandra/ClientExamples
which I have deliberately left incomplete (only projects with commits
in the last month or so, since nothing else has a prayer of working).

moving to its own page is fine with me.

On Wed, Aug 26, 2009 at 7:13 PM, Evan Weaver<ew...@gmail.com> wrote:
> "Clients" section in the README.txt seems best to me.
>
> Evan
>
> On Wed, Aug 26, 2009 at 5:09 PM, Ian Holsman<ia...@holsman.net> wrote:
>> isn't there a way to use svn:external or svn:link to pull them in from their
>> own repos?
>> (not sure how legal it would be).
>> On Aug 27, 2009, at 10:03 AM, Jonathan Ellis wrote:
>>
>>> I thought about that, but I really don't want Cassandra committers to
>>> have to be in the business of updating them all when we make changes,
>>> and having them in the repo creates that expectation even in contrib.
>>>
>>> On Wed, Aug 26, 2009 at 6:57 PM, Ian Holsman<ia...@holsman.net> wrote:
>>>>
>>>> would it be worthwhile to start including these clients in the core
>>>> codebase? in some kind of 'client' or 'contrib' directory?
>>>>
>>>> maybe even mentioning the 'popular' clients that people use in the readme
>>>> (with links to them) would be good.
>>>>
>>>> On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:
>>>>
>>>>> Just would like to say great job so far.
>>>>>
>>>>> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:
>>>>> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
>>>>>
>>>>> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
>>>>> improved it, and more. You ought to switch back to his version.
>>>>>
>>>>> I'm doing some heavy refactoring all this week, to bring it up to
>>>>> Cassandra trunk and simplify/genericize it wherever possible. I should
>>>>> have
>>>>> something to show in a day or two.
>>>>>
>>>>> Feel free to contact me if you have questions or requests.
>>>>>
>>>>>  - Ian
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Salvador Fuentes Jr.
>>>>> 323-540-4SAL
>>>>
>>>> --
>>>> Ian Holsman
>>>> Ian@Holsman.net
>>>>
>>>>
>>>>
>>>>
>>
>> --
>> Ian Holsman
>> Ian@Holsman.net
>>
>>
>>
>>
>
>
>
> --
> Evan Weaver
>

Re: Newbe´s question

Posted by mo...@gmail.com.
just running your example

 python /tmp/columnfamily.py
{'table': 'Keyspace1', 'superkey': None, 'key':
'f8b29cc4193b42bc8a188615855cfa4e', 'family': 'Standard1', 'supercol': None}
{'username': 'ieure', 'email': 'ian@digg.com'}
True
Traceback (most recent call last):
  File "/tmp/columnfamily.py", line 65, in <module>
    u.save()           # -> {'username': 'ieure', 'email': 'ian@digg.com'}
  File "/home/mark/work/common/lazyboy/columnfamily.py", line 127, in save
    self.load(self.pk.key)
  File "/home/mark/work/common/lazyboy/columnfamily.py", line 92, in load
    self._clean()
  File "/home/mark/work/common/lazyboy/columnfamily.py", line 46, in _clean
    map(self.__delitem__, self.keys())
  File "/home/mark/work/common/lazyboy/columnfamily.py", line 86, in
__delitem__
    self._deleted[self._columns[item]] = True
TypeError: unhashable instance


On Wed, Aug 26, 2009 at 6:11 PM, <ia...@digg.com> wrote:

> Don't call __hash__, there is no such method.
>
>
> On Aug 26, 2009, at 5:39 PM, mobiledreamers@gmail.com wrote:
>
> any ideas on how 2 fix this?
> Traceback (most recent call last):
>   File "/tmp/a.py", line 3, in <module>
>     print cassandra.ttypes.Column().__hash__()
> AttributeError: Column instance has no attribute '__hash__'
>
> *
>
> #!/usr/bin/python
> import cassandra.ttypes
> print cassandra.ttypes.Column().__hash__()
> *
> On Wed, Aug 26, 2009 at 5:13 PM, Evan Weaver < <ew...@gmail.com>
> eweaver@gmail.com> wrote:
>
>> "Clients" section in the README.txt seems best to me.
>>
>> Evan
>>
>>
>> On Wed, Aug 26, 2009 at 5:09 PM, Ian Holsman< <ia...@holsman.net>
>> ian@holsman.net> wrote:
>> > isn't there a way to use svn:external or svn:link to pull them in from
>> their
>> > own repos?
>> > (not sure how legal it would be).
>> > On Aug 27, 2009, at 10:03 AM, Jonathan Ellis wrote:
>> >
>> >> I thought about that, but I really don't want Cassandra committers to
>> >> have to be in the business of updating them all when we make changes,
>> >> and having them in the repo creates that expectation even in contrib.
>> >>
>> >> On Wed, Aug 26, 2009 at 6:57 PM, Ian Holsman< <ia...@holsman.net>
>> ian@holsman.net> wrote:
>> >>>
>> >>> would it be worthwhile to start including these clients in the core
>> >>> codebase? in some kind of 'client' or 'contrib' directory?
>> >>>
>> >>> maybe even mentioning the 'popular' clients that people use in the
>> readme
>> >>> (with links to them) would be good.
>> >>>
>> >>> On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:
>> >>>
>> >>>> Just would like to say great job so far.
>> >>>>
>> >>>> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure < <ia...@digg.com>
>> ian@digg.com> wrote:
>> >>>> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
>> >>>>
>> >>>> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
>> >>>> improved it, and more. You ought to switch back to his version.
>> >>>>
>> >>>> I'm doing some heavy refactoring all this week, to bring it up to
>> >>>> Cassandra trunk and simplify/genericize it wherever possible. I
>> should
>> >>>> have
>> >>>> something to show in a day or two.
>> >>>>
>> >>>> Feel free to contact me if you have questions or requests.
>> >>>>
>> >>>>  - Ian
>> >>>>
>> >>>>
>> >>>>
>> >>>> --
>> >>>> Salvador Fuentes Jr.
>> >>>> 323-540-4SAL
>> >>>
>> >>> --
>> >>> Ian Holsman
>> >>> <Ia...@Holsman.net>Ian@Holsman.net
>> >>>
>> >>>
>> >>>
>> >>>
>> >
>> > --
>> > Ian Holsman
>> > <Ia...@Holsman.net>Ian@Holsman.net
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> Evan Weaver
>>
>
>
>
> --
> Bidegg worlds best auction site
> <http://bidegg.com>http://bidegg.com
>
>


-- 
Bidegg worlds best auction site
http://bidegg.com

Re: Newbe´s question

Posted by ia...@digg.com.
Don't call __hash__, there is no such method.


On Aug 26, 2009, at 5:39 PM, mobiledreamers@gmail.com wrote:

> any ideas on how 2 fix this?
> Traceback (most recent call last):
>   File "/tmp/a.py", line 3, in <module>
>     print cassandra.ttypes.Column().__hash__()
> AttributeError: Column instance has no attribute '__hash__'
>
>
>
> #!/usr/bin/python
> import cassandra.ttypes
> print cassandra.ttypes.Column().__hash__()
>
> On Wed, Aug 26, 2009 at 5:13 PM, Evan Weaver <ew...@gmail.com>  
> wrote:
> "Clients" section in the README.txt seems best to me.
>
> Evan
>
> On Wed, Aug 26, 2009 at 5:09 PM, Ian Holsman<ia...@holsman.net> wrote:
> > isn't there a way to use svn:external or svn:link to pull them in  
> from their
> > own repos?
> > (not sure how legal it would be).
> > On Aug 27, 2009, at 10:03 AM, Jonathan Ellis wrote:
> >
> >> I thought about that, but I really don't want Cassandra  
> committers to
> >> have to be in the business of updating them all when we make  
> changes,
> >> and having them in the repo creates that expectation even in  
> contrib.
> >>
> >> On Wed, Aug 26, 2009 at 6:57 PM, Ian Holsman<ia...@holsman.net>  
> wrote:
> >>>
> >>> would it be worthwhile to start including these clients in the  
> core
> >>> codebase? in some kind of 'client' or 'contrib' directory?
> >>>
> >>> maybe even mentioning the 'popular' clients that people use in  
> the readme
> >>> (with links to them) would be good.
> >>>
> >>> On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:
> >>>
> >>>> Just would like to say great job so far.
> >>>>
> >>>> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:
> >>>> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
> >>>>
> >>>> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
> >>>> improved it, and more. You ought to switch back to his version.
> >>>>
> >>>> I'm doing some heavy refactoring all this week, to bring it up to
> >>>> Cassandra trunk and simplify/genericize it wherever possible. I  
> should
> >>>> have
> >>>> something to show in a day or two.
> >>>>
> >>>> Feel free to contact me if you have questions or requests.
> >>>>
> >>>>  - Ian
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Salvador Fuentes Jr.
> >>>> 323-540-4SAL
> >>>
> >>> --
> >>> Ian Holsman
> >>> Ian@Holsman.net
> >>>
> >>>
> >>>
> >>>
> >
> > --
> > Ian Holsman
> > Ian@Holsman.net
> >
> >
> >
> >
>
>
>
> --
> Evan Weaver
>
>
>
> -- 
> Bidegg worlds best auction site
> http://bidegg.com

Re: Newbe´s question

Posted by mo...@gmail.com.
any ideas on how 2 fix this?
Traceback (most recent call last):
  File "/tmp/a.py", line 3, in <module>
    print cassandra.ttypes.Column().__hash__()
AttributeError: Column instance has no attribute '__hash__'

*

#!/usr/bin/python
import cassandra.ttypes
print cassandra.ttypes.Column().__hash__()
*
On Wed, Aug 26, 2009 at 5:13 PM, Evan Weaver <ew...@gmail.com> wrote:

> "Clients" section in the README.txt seems best to me.
>
> Evan
>
> On Wed, Aug 26, 2009 at 5:09 PM, Ian Holsman<ia...@holsman.net> wrote:
> > isn't there a way to use svn:external or svn:link to pull them in from
> their
> > own repos?
> > (not sure how legal it would be).
> > On Aug 27, 2009, at 10:03 AM, Jonathan Ellis wrote:
> >
> >> I thought about that, but I really don't want Cassandra committers to
> >> have to be in the business of updating them all when we make changes,
> >> and having them in the repo creates that expectation even in contrib.
> >>
> >> On Wed, Aug 26, 2009 at 6:57 PM, Ian Holsman<ia...@holsman.net> wrote:
> >>>
> >>> would it be worthwhile to start including these clients in the core
> >>> codebase? in some kind of 'client' or 'contrib' directory?
> >>>
> >>> maybe even mentioning the 'popular' clients that people use in the
> readme
> >>> (with links to them) would be good.
> >>>
> >>> On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:
> >>>
> >>>> Just would like to say great job so far.
> >>>>
> >>>> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:
> >>>> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
> >>>>
> >>>> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
> >>>> improved it, and more. You ought to switch back to his version.
> >>>>
> >>>> I'm doing some heavy refactoring all this week, to bring it up to
> >>>> Cassandra trunk and simplify/genericize it wherever possible. I should
> >>>> have
> >>>> something to show in a day or two.
> >>>>
> >>>> Feel free to contact me if you have questions or requests.
> >>>>
> >>>>  - Ian
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Salvador Fuentes Jr.
> >>>> 323-540-4SAL
> >>>
> >>> --
> >>> Ian Holsman
> >>> Ian@Holsman.net
> >>>
> >>>
> >>>
> >>>
> >
> > --
> > Ian Holsman
> > Ian@Holsman.net
> >
> >
> >
> >
>
>
>
> --
> Evan Weaver
>



-- 
Bidegg worlds best auction site
http://bidegg.com

Re: Newbe´s question

Posted by Evan Weaver <ew...@gmail.com>.
"Clients" section in the README.txt seems best to me.

Evan

On Wed, Aug 26, 2009 at 5:09 PM, Ian Holsman<ia...@holsman.net> wrote:
> isn't there a way to use svn:external or svn:link to pull them in from their
> own repos?
> (not sure how legal it would be).
> On Aug 27, 2009, at 10:03 AM, Jonathan Ellis wrote:
>
>> I thought about that, but I really don't want Cassandra committers to
>> have to be in the business of updating them all when we make changes,
>> and having them in the repo creates that expectation even in contrib.
>>
>> On Wed, Aug 26, 2009 at 6:57 PM, Ian Holsman<ia...@holsman.net> wrote:
>>>
>>> would it be worthwhile to start including these clients in the core
>>> codebase? in some kind of 'client' or 'contrib' directory?
>>>
>>> maybe even mentioning the 'popular' clients that people use in the readme
>>> (with links to them) would be good.
>>>
>>> On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:
>>>
>>>> Just would like to say great job so far.
>>>>
>>>> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:
>>>> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
>>>>
>>>> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
>>>> improved it, and more. You ought to switch back to his version.
>>>>
>>>> I'm doing some heavy refactoring all this week, to bring it up to
>>>> Cassandra trunk and simplify/genericize it wherever possible. I should
>>>> have
>>>> something to show in a day or two.
>>>>
>>>> Feel free to contact me if you have questions or requests.
>>>>
>>>>  - Ian
>>>>
>>>>
>>>>
>>>> --
>>>> Salvador Fuentes Jr.
>>>> 323-540-4SAL
>>>
>>> --
>>> Ian Holsman
>>> Ian@Holsman.net
>>>
>>>
>>>
>>>
>
> --
> Ian Holsman
> Ian@Holsman.net
>
>
>
>



-- 
Evan Weaver

Re: Newbe?s question

Posted by Anthony Molinaro <an...@alumni.caltech.edu>.
Now now, we use subversion at OpenX and we are probably the only people who
use Cassandra 0.3.0 in production, can't get more cutting edge than that
:)

-Anthony

On Wed, Aug 26, 2009 at 07:31:48PM -0500, Jonathan Ellis wrote:
> Off the top of my head, I can't think of any that actually use svn so
> it's probably a moot point anyway.
> 
> Subversion has practically zero mindshare now in the cutting edge
> crowd (which most of cassandra's users come from, unsurprisingly :).
> 
> -Jonathan
> 
> On Wed, Aug 26, 2009 at 7:09 PM, Ian Holsman<ia...@holsman.net> wrote:
> > isn't there a way to use svn:external or svn:link to pull them in from their
> > own repos?
> > (not sure how legal it would be).
> > On Aug 27, 2009, at 10:03 AM, Jonathan Ellis wrote:
> >
> >> I thought about that, but I really don't want Cassandra committers to
> >> have to be in the business of updating them all when we make changes,
> >> and having them in the repo creates that expectation even in contrib.
> >>
> >> On Wed, Aug 26, 2009 at 6:57 PM, Ian Holsman<ia...@holsman.net> wrote:
> >>>
> >>> would it be worthwhile to start including these clients in the core
> >>> codebase? in some kind of 'client' or 'contrib' directory?
> >>>
> >>> maybe even mentioning the 'popular' clients that people use in the readme
> >>> (with links to them) would be good.
> >>>
> >>> On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:
> >>>
> >>>> Just would like to say great job so far.
> >>>>
> >>>> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:
> >>>> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
> >>>>
> >>>> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
> >>>> improved it, and more. You ought to switch back to his version.
> >>>>
> >>>> I'm doing some heavy refactoring all this week, to bring it up to
> >>>> Cassandra trunk and simplify/genericize it wherever possible. I should
> >>>> have
> >>>> something to show in a day or two.
> >>>>
> >>>> Feel free to contact me if you have questions or requests.
> >>>>
> >>>>  - Ian
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Salvador Fuentes Jr.
> >>>> 323-540-4SAL
> >>>
> >>> --
> >>> Ian Holsman
> >>> Ian@Holsman.net
> >>>
> >>>
> >>>
> >>>
> >
> > --
> > Ian Holsman
> > Ian@Holsman.net
> >
> >
> >
> >

-- 
------------------------------------------------------------------------
Anthony Molinaro                           <an...@alumni.caltech.edu>

Re: Newbe´s question

Posted by Eric Evans <ee...@rackspace.com>.
On Wed, 2009-08-26 at 17:33 -0700, Chris Goffinet wrote:
> Don't know what you're talking about, I am still rolling with CVS.

Oh, what a twisted sense of humor you have Chris.

-- 
Eric Evans
eevans@rackspace.com


Re: Newbe´s question

Posted by Chris Goffinet <go...@digg.com>.
Don't know what you're talking about, I am still rolling with CVS.

-Chris

On Aug 26, 2009, at 5:31 PM, Jonathan Ellis wrote:

> Off the top of my head, I can't think of any that actually use svn so
> it's probably a moot point anyway.
>
> Subversion has practically zero mindshare now in the cutting edge
> crowd (which most of cassandra's users come from, unsurprisingly :).
>
> -Jonathan
>
> On Wed, Aug 26, 2009 at 7:09 PM, Ian Holsman<ia...@holsman.net> wrote:
>> isn't there a way to use svn:external or svn:link to pull them in  
>> from their
>> own repos?
>> (not sure how legal it would be).
>> On Aug 27, 2009, at 10:03 AM, Jonathan Ellis wrote:
>>
>>> I thought about that, but I really don't want Cassandra committers  
>>> to
>>> have to be in the business of updating them all when we make  
>>> changes,
>>> and having them in the repo creates that expectation even in  
>>> contrib.
>>>
>>> On Wed, Aug 26, 2009 at 6:57 PM, Ian Holsman<ia...@holsman.net> wrote:
>>>>
>>>> would it be worthwhile to start including these clients in the core
>>>> codebase? in some kind of 'client' or 'contrib' directory?
>>>>
>>>> maybe even mentioning the 'popular' clients that people use in  
>>>> the readme
>>>> (with links to them) would be good.
>>>>
>>>> On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:
>>>>
>>>>> Just would like to say great job so far.
>>>>>
>>>>> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:
>>>>> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
>>>>>
>>>>> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
>>>>> improved it, and more. You ought to switch back to his version.
>>>>>
>>>>> I'm doing some heavy refactoring all this week, to bring it up to
>>>>> Cassandra trunk and simplify/genericize it wherever possible. I  
>>>>> should
>>>>> have
>>>>> something to show in a day or two.
>>>>>
>>>>> Feel free to contact me if you have questions or requests.
>>>>>
>>>>>  - Ian
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Salvador Fuentes Jr.
>>>>> 323-540-4SAL
>>>>
>>>> --
>>>> Ian Holsman
>>>> Ian@Holsman.net
>>>>
>>>>
>>>>
>>>>
>>
>> --
>> Ian Holsman
>> Ian@Holsman.net
>>
>>
>>
>>


Re: Newbe´s question

Posted by Jonathan Ellis <jb...@gmail.com>.
Off the top of my head, I can't think of any that actually use svn so
it's probably a moot point anyway.

Subversion has practically zero mindshare now in the cutting edge
crowd (which most of cassandra's users come from, unsurprisingly :).

-Jonathan

On Wed, Aug 26, 2009 at 7:09 PM, Ian Holsman<ia...@holsman.net> wrote:
> isn't there a way to use svn:external or svn:link to pull them in from their
> own repos?
> (not sure how legal it would be).
> On Aug 27, 2009, at 10:03 AM, Jonathan Ellis wrote:
>
>> I thought about that, but I really don't want Cassandra committers to
>> have to be in the business of updating them all when we make changes,
>> and having them in the repo creates that expectation even in contrib.
>>
>> On Wed, Aug 26, 2009 at 6:57 PM, Ian Holsman<ia...@holsman.net> wrote:
>>>
>>> would it be worthwhile to start including these clients in the core
>>> codebase? in some kind of 'client' or 'contrib' directory?
>>>
>>> maybe even mentioning the 'popular' clients that people use in the readme
>>> (with links to them) would be good.
>>>
>>> On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:
>>>
>>>> Just would like to say great job so far.
>>>>
>>>> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:
>>>> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
>>>>
>>>> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
>>>> improved it, and more. You ought to switch back to his version.
>>>>
>>>> I'm doing some heavy refactoring all this week, to bring it up to
>>>> Cassandra trunk and simplify/genericize it wherever possible. I should
>>>> have
>>>> something to show in a day or two.
>>>>
>>>> Feel free to contact me if you have questions or requests.
>>>>
>>>>  - Ian
>>>>
>>>>
>>>>
>>>> --
>>>> Salvador Fuentes Jr.
>>>> 323-540-4SAL
>>>
>>> --
>>> Ian Holsman
>>> Ian@Holsman.net
>>>
>>>
>>>
>>>
>
> --
> Ian Holsman
> Ian@Holsman.net
>
>
>
>

Re: Newbe´s question

Posted by Ian Holsman <ia...@holsman.net>.
isn't there a way to use svn:external or svn:link to pull them in from  
their own repos?
(not sure how legal it would be).
On Aug 27, 2009, at 10:03 AM, Jonathan Ellis wrote:

> I thought about that, but I really don't want Cassandra committers to
> have to be in the business of updating them all when we make changes,
> and having them in the repo creates that expectation even in contrib.
>
> On Wed, Aug 26, 2009 at 6:57 PM, Ian Holsman<ia...@holsman.net> wrote:
>> would it be worthwhile to start including these clients in the core
>> codebase? in some kind of 'client' or 'contrib' directory?
>>
>> maybe even mentioning the 'popular' clients that people use in the  
>> readme
>> (with links to them) would be good.
>>
>> On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:
>>
>>> Just would like to say great job so far.
>>>
>>> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:
>>> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
>>>
>>> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
>>> improved it, and more. You ought to switch back to his version.
>>>
>>> I'm doing some heavy refactoring all this week, to bring it up to
>>> Cassandra trunk and simplify/genericize it wherever possible. I  
>>> should have
>>> something to show in a day or two.
>>>
>>> Feel free to contact me if you have questions or requests.
>>>
>>>  - Ian
>>>
>>>
>>>
>>> --
>>> Salvador Fuentes Jr.
>>> 323-540-4SAL
>>
>> --
>> Ian Holsman
>> Ian@Holsman.net
>>
>>
>>
>>

--
Ian Holsman
Ian@Holsman.net




Re: Newbe´s question

Posted by Jonathan Ellis <jb...@gmail.com>.
I thought about that, but I really don't want Cassandra committers to
have to be in the business of updating them all when we make changes,
and having them in the repo creates that expectation even in contrib.

On Wed, Aug 26, 2009 at 6:57 PM, Ian Holsman<ia...@holsman.net> wrote:
> would it be worthwhile to start including these clients in the core
> codebase? in some kind of 'client' or 'contrib' directory?
>
> maybe even mentioning the 'popular' clients that people use in the readme
> (with links to them) would be good.
>
> On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:
>
>> Just would like to say great job so far.
>>
>> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:
>> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
>>
>> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
>> improved it, and more. You ought to switch back to his version.
>>
>> I'm doing some heavy refactoring all this week, to bring it up to
>> Cassandra trunk and simplify/genericize it wherever possible. I should have
>> something to show in a day or two.
>>
>> Feel free to contact me if you have questions or requests.
>>
>>  - Ian
>>
>>
>>
>> --
>> Salvador Fuentes Jr.
>> 323-540-4SAL
>
> --
> Ian Holsman
> Ian@Holsman.net
>
>
>
>

Re: Newbe´s question

Posted by Eric Evans <ee...@rackspace.com>.
On Thu, 2009-08-27 at 09:57 +1000, Ian Holsman wrote:
> would it be worthwhile to start including these clients in the core  
> codebase? in some kind of 'client' or 'contrib' directory?

IMO, it would be better for the clients and those working on them to
continue managing them as separate projects outside of Cassandra's
code-base, (flexibility on choice of committers, vcs/tools, release
cycles, licensing, etc).

> maybe even mentioning the 'popular' clients that people use in the  
> readme (with links to them) would be good.

Yeah, this is probably a good idea. Either README.txt or a
(prominent )page on the wiki (which I guess would be easier to keep to
date).

-- 
Eric Evans
eevans@rackspace.com


Re: Newbe´s question

Posted by Ian Holsman <ia...@holsman.net>.
would it be worthwhile to start including these clients in the core  
codebase? in some kind of 'client' or 'contrib' directory?

maybe even mentioning the 'popular' clients that people use in the  
readme (with links to them) would be good.

On Aug 27, 2009, at 9:18 AM, Sal Fuentes wrote:

> Just would like to say great job so far.
>
> On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:
> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
>
> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
> improved it, and more. You ought to switch back to his version.
>
> I'm doing some heavy refactoring all this week, to bring it up to  
> Cassandra trunk and simplify/genericize it wherever possible. I  
> should have something to show in a day or two.
>
> Feel free to contact me if you have questions or requests.
>
>  - Ian
>
>
>
> -- 
> Salvador Fuentes Jr.
> 323-540-4SAL

--
Ian Holsman
Ian@Holsman.net




Re: Newbe´s question

Posted by Sal Fuentes <fu...@gmail.com>.
Just would like to say great job so far.

On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <ia...@digg.com> wrote:

> On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:
>
>  For anyone using my branch of Lazyboy, Ian Eure pulled my work,
>> improved it, and more. You ought to switch back to his version.
>>
>>  I'm doing some heavy refactoring all this week, to bring it up to
> Cassandra trunk and simplify/genericize it wherever possible. I should have
> something to show in a day or two.
>
> Feel free to contact me if you have questions or requests.
>
>  - Ian
>



-- 
Salvador Fuentes Jr.
323-540-4SAL

Re: Newbe´s question

Posted by Ian Eure <ia...@digg.com>.
On Aug 25, 2009, at 2:46 PM, Drew Schleck wrote:

> For anyone using my branch of Lazyboy, Ian Eure pulled my work,
> improved it, and more. You ought to switch back to his version.
>
I'm doing some heavy refactoring all this week, to bring it up to  
Cassandra trunk and simplify/genericize it wherever possible. I should  
have something to show in a day or two.

Feel free to contact me if you have questions or requests.

  - Ian

Re: Newbe´s question

Posted by Drew Schleck <dr...@gmail.com>.
For anyone using my branch of Lazyboy, Ian Eure pulled my work,
improved it, and more. You ought to switch back to his version.

Drew

Re: Newbe´s question

Posted by Drew Schleck <dr...@gmail.com>.
Oops, class Items should be:
class Items(supercolumn.SuperColumn):
    _key = { 'table': 'keyspace',
             'family': 'Items' }
    name = "Items"
    family = Item

I knew I should proofread...


On Mon, Aug 24, 2009 at 23:07, Drew Schleck<dr...@gmail.com> wrote:
> It's not my Lazyboy, give the Digg guys credit for doing almost all of
> the work. I found out most of this by just looking at the provided
> unit tests, even if you can't run them they are helpful.
>
> Columns:
> class User(columnfamily.ColumnFamily):
>    _key = { 'table': 'keyspace',
>             'family': 'Users' }
>
>    _required = ('password', 'salt')
>
> Super columns:
> class Item(supercolumnfamily.SuperColumnFamily):
>    _key = { 'table': 'keyspace',
>             'supercol': 'Items' }
>
> class Items(supercolumn.SuperColumn):
>    _key = { 'table': 'kayspace',
>             'family': 'Items' }
>    name = "Items"
>
> Drew
>
> On Mon, Aug 24, 2009 at 21:26, <mo...@gmail.com> wrote:
>> hey Drew
>> Can you show an example on how to use your lazyboy with a simple column
>> family or super columny family
>> that would be really great
>> thanks a lot
>>
>> On Mon, Aug 24, 2009 at 3:15 PM, Drew Schleck <dr...@gmail.com>
>> wrote:
>>>
>>> I've been working on a Lazyboy 0.4 update at
>>> http://github.com/dschleck/lazyboy/ . Right now it's at the point
>>> where it works for me and what I'm doing but there's probably a few
>>> bugs to be caught. As an example, yesterday I noticed it wasn't
>>> possible to delete items out of supercolumns so I fixed that.
>>>
>>> If you decide to use my branch of it and find a bug, please tell me
>>> about it and I'll do my best to sort it out.
>>>
>>> Drew
>>>
>>> On Mon, Aug 24, 2009 at 12:09, Evan Weaver<ew...@gmail.com> wrote:
>>> > The Ruby client works fine. ;-)
>>> >
>>> > Evan
>>> >
>>> > On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<jb...@gmail.com>
>>> > wrote:
>>> >> That's probably the best option at the moment.  Once you're familiar
>>> >> with the thrift API I'm sure the lazyboy devs would welcome updates
>>> >> too.
>>> >>
>>> >> -Jonathan
>>> >>
>>> >> On Mon, Aug 24, 2009 at 1:54 PM, Bruno Couto<bc...@gmail.com> wrote:
>>> >>> Thanks for helpping me Jonathan!
>>> >>>
>>> >>> Well, now I know that I can´t use the Lazyboy, then I will try my
>>> >>> first steps using the Cassandra trunk version and thrift api whitout a
>>> >>> wrapper.
>>> >>>
>>> >>>
>>> >>> On Mon, Aug 24, 2009 at 2:41 PM, Jonathan Ellis<jb...@gmail.com>
>>> >>> wrote:
>>> >>>> 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<bc...@gmail.com>
>>> >>>> wrote:
>>> >>>>> Jonathan,
>>> >>>>>
>>> >>>>>
>>> >>>>> First, thanks for answering so fast.
>>> >>>>> I´m 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<jb...@gmail.com>
>>> >>>>> wrote:
>>> >>>>>> There's two things going on here, I think.
>>> >>>>>>
>>> >>>>>> One is that you're passing a null where there shouldn't be one.
>>> >>>>>>  This
>>> >>>>>> 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<bc...@gmail.com>
>>> >>>>>> 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´m 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.java:284)
>>> >>>>>>>        at
>>> >>>>>>> org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
>>> >>>>>>>        at
>>> >>>>>>> org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
>>> >>>>>>>        at
>>> >>>>>>> org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
>>> >>>>>>>        at
>>> >>>>>>> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
>>> >>>>>>>        at
>>> >>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>> >>>>>>>        at
>>> >>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
>>> >>>>>>>    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 func
>>> >>>>>>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing
>>> >>>>>>> batch_insert
>>> >>>>>>>
>>> >>>>>>> ----
>>> >>>>>>>
>>> >>>>>>> ColumnFamily.py
>>> >>>>>>>
>>> >>>>>>> # -*- coding: utf-8 -*-
>>> >>>>>>> #
>>> >>>>>>> # Lazyboy examples
>>> >>>>>>> #
>>> >>>>>>> # © 2009 Digg, Inc. All rights reserved.
>>> >>>>>>> # Author: Ian Eure <ia...@digg.com>
>>> >>>>>>> #
>>> >>>>>>> # This example assumes the following schema:
>>> >>>>>>> #
>>> >>>>>>> # <Tables>
>>> >>>>>>> #     <Table Name="UserData">
>>> >>>>>>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
>>> >>>>>>> #     </Table>
>>> >>>>>>> # </Tables>
>>> >>>>>>> #
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>>> 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 = {'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 = ('username',)
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>>> # Create an empty object
>>> >>>>>>> u = User()
>>> >>>>>>>
>>> >>>>>>> # A PrimaryKey is generated for you:
>>> >>>>>>> print u.pk
>>> >>>>>>> # -> {'table': 'UserData', 'superkey': None,
>>> >>>>>>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
>>> >>>>>>> #     'family': 'Users', 'supercol': None}
>>> >>>>>>>
>>> >>>>>>> data = {'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] = data[k]
>>> >>>>>>>
>>> >>>>>>> # Arguments to __init__ are passed to update()
>>> >>>>>>> u = 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_ = 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
>>> >>>>>>>
>>> >>>>>>
>>> >>>>>
>>> >>>>
>>> >>>
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Evan Weaver
>>> >
>>
>>
>>
>> --
>> Bidegg worlds best auction site
>> http://bidegg.com
>>
>

Re: Newbe´s question

Posted by Drew Schleck <dr...@gmail.com>.
It's not my Lazyboy, give the Digg guys credit for doing almost all of
the work. I found out most of this by just looking at the provided
unit tests, even if you can't run them they are helpful.

Columns:
class User(columnfamily.ColumnFamily):
    _key = { 'table': 'keyspace',
             'family': 'Users' }

    _required = ('password', 'salt')

Super columns:
class Item(supercolumnfamily.SuperColumnFamily):
    _key = { 'table': 'keyspace',
             'supercol': 'Items' }

class Items(supercolumn.SuperColumn):
    _key = { 'table': 'kayspace',
             'family': 'Items' }
    name = "Items"

Drew

On Mon, Aug 24, 2009 at 21:26, <mo...@gmail.com> wrote:
> hey Drew
> Can you show an example on how to use your lazyboy with a simple column
> family or super columny family
> that would be really great
> thanks a lot
>
> On Mon, Aug 24, 2009 at 3:15 PM, Drew Schleck <dr...@gmail.com>
> wrote:
>>
>> I've been working on a Lazyboy 0.4 update at
>> http://github.com/dschleck/lazyboy/ . Right now it's at the point
>> where it works for me and what I'm doing but there's probably a few
>> bugs to be caught. As an example, yesterday I noticed it wasn't
>> possible to delete items out of supercolumns so I fixed that.
>>
>> If you decide to use my branch of it and find a bug, please tell me
>> about it and I'll do my best to sort it out.
>>
>> Drew
>>
>> On Mon, Aug 24, 2009 at 12:09, Evan Weaver<ew...@gmail.com> wrote:
>> > The Ruby client works fine. ;-)
>> >
>> > Evan
>> >
>> > On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<jb...@gmail.com>
>> > wrote:
>> >> That's probably the best option at the moment.  Once you're familiar
>> >> with the thrift API I'm sure the lazyboy devs would welcome updates
>> >> too.
>> >>
>> >> -Jonathan
>> >>
>> >> On Mon, Aug 24, 2009 at 1:54 PM, Bruno Couto<bc...@gmail.com> wrote:
>> >>> Thanks for helpping me Jonathan!
>> >>>
>> >>> Well, now I know that I can´t use the Lazyboy, then I will try my
>> >>> first steps using the Cassandra trunk version and thrift api whitout a
>> >>> wrapper.
>> >>>
>> >>>
>> >>> On Mon, Aug 24, 2009 at 2:41 PM, Jonathan Ellis<jb...@gmail.com>
>> >>> wrote:
>> >>>> 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<bc...@gmail.com>
>> >>>> wrote:
>> >>>>> Jonathan,
>> >>>>>
>> >>>>>
>> >>>>> First, thanks for answering so fast.
>> >>>>> I´m 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<jb...@gmail.com>
>> >>>>> wrote:
>> >>>>>> There's two things going on here, I think.
>> >>>>>>
>> >>>>>> One is that you're passing a null where there shouldn't be one.
>> >>>>>>  This
>> >>>>>> 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<bc...@gmail.com>
>> >>>>>> 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´m 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.java:284)
>> >>>>>>>        at
>> >>>>>>> org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
>> >>>>>>>        at
>> >>>>>>> org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
>> >>>>>>>        at
>> >>>>>>> org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
>> >>>>>>>        at
>> >>>>>>> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
>> >>>>>>>        at
>> >>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> >>>>>>>        at
>> >>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
>> >>>>>>>    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 func
>> >>>>>>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing
>> >>>>>>> batch_insert
>> >>>>>>>
>> >>>>>>> ----
>> >>>>>>>
>> >>>>>>> ColumnFamily.py
>> >>>>>>>
>> >>>>>>> # -*- coding: utf-8 -*-
>> >>>>>>> #
>> >>>>>>> # Lazyboy examples
>> >>>>>>> #
>> >>>>>>> # © 2009 Digg, Inc. All rights reserved.
>> >>>>>>> # Author: Ian Eure <ia...@digg.com>
>> >>>>>>> #
>> >>>>>>> # This example assumes the following schema:
>> >>>>>>> #
>> >>>>>>> # <Tables>
>> >>>>>>> #     <Table Name="UserData">
>> >>>>>>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
>> >>>>>>> #     </Table>
>> >>>>>>> # </Tables>
>> >>>>>>> #
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> 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 = {'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 = ('username',)
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> # Create an empty object
>> >>>>>>> u = User()
>> >>>>>>>
>> >>>>>>> # A PrimaryKey is generated for you:
>> >>>>>>> print u.pk
>> >>>>>>> # -> {'table': 'UserData', 'superkey': None,
>> >>>>>>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
>> >>>>>>> #     'family': 'Users', 'supercol': None}
>> >>>>>>>
>> >>>>>>> data = {'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] = data[k]
>> >>>>>>>
>> >>>>>>> # Arguments to __init__ are passed to update()
>> >>>>>>> u = 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_ = 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
>> >>>>>>>
>> >>>>>>
>> >>>>>
>> >>>>
>> >>>
>> >>
>> >
>> >
>> >
>> > --
>> > Evan Weaver
>> >
>
>
>
> --
> Bidegg worlds best auction site
> http://bidegg.com
>

Re: Newbe´s question

Posted by mo...@gmail.com.
hey Drew
Can you show an example on how to use your lazyboy with a simple column
family or super columny familythat would be really great
thanks a lot

On Mon, Aug 24, 2009 at 3:15 PM, Drew Schleck <dr...@gmail.com>wrote:

> I've been working on a Lazyboy 0.4 update at
> http://github.com/dschleck/lazyboy/ . Right now it's at the point
> where it works for me and what I'm doing but there's probably a few
> bugs to be caught. As an example, yesterday I noticed it wasn't
> possible to delete items out of supercolumns so I fixed that.
>
> If you decide to use my branch of it and find a bug, please tell me
> about it and I'll do my best to sort it out.
>
> Drew
>
> On Mon, Aug 24, 2009 at 12:09, Evan Weaver<ew...@gmail.com> wrote:
> > The Ruby client works fine. ;-)
> >
> > Evan
> >
> > On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<jb...@gmail.com>
> wrote:
> >> That's probably the best option at the moment.  Once you're familiar
> >> with the thrift API I'm sure the lazyboy devs would welcome updates
> >> too.
> >>
> >> -Jonathan
> >>
> >> On Mon, Aug 24, 2009 at 1:54 PM, Bruno Couto<bc...@gmail.com> wrote:
> >>> Thanks for helpping me Jonathan!
> >>>
> >>> Well, now I know that I can´t use the Lazyboy, then I will try my
> >>> first steps using the Cassandra trunk version and thrift api whitout a
> >>> wrapper.
> >>>
> >>>
> >>> On Mon, Aug 24, 2009 at 2:41 PM, Jonathan Ellis<jb...@gmail.com>
> wrote:
> >>>> 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<bc...@gmail.com>
> wrote:
> >>>>> Jonathan,
> >>>>>
> >>>>>
> >>>>> First, thanks for answering so fast.
> >>>>> I´m 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<jb...@gmail.com>
> wrote:
> >>>>>> There's two things going on here, I think.
> >>>>>>
> >>>>>> One is that you're passing a null where there shouldn't be one.
>  This
> >>>>>> 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<bc...@gmail.com>
> 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´m 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.java:284)
> >>>>>>>        at
> org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
> >>>>>>>        at
> org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
> >>>>>>>        at
> org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
> >>>>>>>        at
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
> >>>>>>>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> >>>>>>>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
> >>>>>>>    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 func
> >>>>>>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing
> batch_insert
> >>>>>>>
> >>>>>>> ----
> >>>>>>>
> >>>>>>> ColumnFamily.py
> >>>>>>>
> >>>>>>> # -*- coding: utf-8 -*-
> >>>>>>> #
> >>>>>>> # Lazyboy examples
> >>>>>>> #
> >>>>>>> # © 2009 Digg, Inc. All rights reserved.
> >>>>>>> # Author: Ian Eure <ia...@digg.com>
> >>>>>>> #
> >>>>>>> # This example assumes the following schema:
> >>>>>>> #
> >>>>>>> # <Tables>
> >>>>>>> #     <Table Name="UserData">
> >>>>>>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
> >>>>>>> #     </Table>
> >>>>>>> # </Tables>
> >>>>>>> #
> >>>>>>>
> >>>>>>>
> >>>>>>> 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 = {'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 = ('username',)
> >>>>>>>
> >>>>>>>
> >>>>>>> # Create an empty object
> >>>>>>> u = User()
> >>>>>>>
> >>>>>>> # A PrimaryKey is generated for you:
> >>>>>>> print u.pk
> >>>>>>> # -> {'table': 'UserData', 'superkey': None,
> >>>>>>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
> >>>>>>> #     'family': 'Users', 'supercol': None}
> >>>>>>>
> >>>>>>> data = {'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] = data[k]
> >>>>>>>
> >>>>>>> # Arguments to __init__ are passed to update()
> >>>>>>> u = 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_ = 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
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>
> >>
> >
> >
> >
> > --
> > Evan Weaver
> >
>



-- 
Bidegg worlds best auction site
http://bidegg.com

Re: Newbe´s question

Posted by Chris Goffinet <go...@digg.com>.
Please send pull requests to Digg, our guys can merge them in.

---
Chris Goffinet
goffinet@digg.com





On Aug 24, 2009, at 3:15 PM, Drew Schleck wrote:

> I've been working on a Lazyboy 0.4 update at
> http://github.com/dschleck/lazyboy/ . Right now it's at the point
> where it works for me and what I'm doing but there's probably a few
> bugs to be caught. As an example, yesterday I noticed it wasn't
> possible to delete items out of supercolumns so I fixed that.
>
> If you decide to use my branch of it and find a bug, please tell me
> about it and I'll do my best to sort it out.
>
> Drew
>
> On Mon, Aug 24, 2009 at 12:09, Evan Weaver<ew...@gmail.com> wrote:
>> The Ruby client works fine. ;-)
>>
>> Evan
>>
>> On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<jb...@gmail.com>  
>> wrote:
>>> That's probably the best option at the moment.  Once you're familiar
>>> with the thrift API I'm sure the lazyboy devs would welcome updates
>>> too.
>>>
>>> -Jonathan
>>>
>>> On Mon, Aug 24, 2009 at 1:54 PM, Bruno Couto<bc...@gmail.com>  
>>> wrote:
>>>> Thanks for helpping me Jonathan!
>>>>
>>>> Well, now I know that I can´t use the Lazyboy, then I will try my
>>>> first steps using the Cassandra trunk version and thrift api  
>>>> whitout a
>>>> wrapper.
>>>>
>>>>
>>>> On Mon, Aug 24, 2009 at 2:41 PM, Jonathan  
>>>> Ellis<jb...@gmail.com> wrote:
>>>>> 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<bc...@gmail.com>  
>>>>> wrote:
>>>>>> Jonathan,
>>>>>>
>>>>>>
>>>>>> First, thanks for answering so fast.
>>>>>> I´m 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<jbellis@gmail.com 
>>>>>> > wrote:
>>>>>>> There's two things going on here, I think.
>>>>>>>
>>>>>>> One is that you're passing a null where there shouldn't be  
>>>>>>> one.  This
>>>>>>> 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<bc...@gmail.com>  
>>>>>>> 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´m 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.java:284)
>>>>>>>>        at  
>>>>>>>> org 
>>>>>>>> .apache 
>>>>>>>> .cassandra 
>>>>>>>> .service.CassandraServer.batch_insert(CassandraServer.java:318)
>>>>>>>>        at org.apache.cassandra.service.Cassandra$Processor 
>>>>>>>> $batch_insert.process(Cassandra.java:968)
>>>>>>>>        at org.apache.cassandra.service.Cassandra 
>>>>>>>> $Processor.process(Cassandra.java:807)
>>>>>>>>        at org.apache.thrift.server.TThreadPoolServer 
>>>>>>>> $WorkerProcess.run(TThreadPoolServer.java:252)
>>>>>>>>        at java.util.concurrent.ThreadPoolExecutor 
>>>>>>>> $Worker.runTask(ThreadPoolExecutor.java:886)
>>>>>>>>        at java.util.concurrent.ThreadPoolExecutor 
>>>>>>>> $Worker.run(ThreadPoolExecutor.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 <module>
>>>>>>>>    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 func
>>>>>>>> lazyboy.exceptions.ErrorThriftMessage: Internal error  
>>>>>>>> processing batch_insert
>>>>>>>>
>>>>>>>> ----
>>>>>>>>
>>>>>>>> ColumnFamily.py
>>>>>>>>
>>>>>>>> # -*- coding: utf-8 -*-
>>>>>>>> #
>>>>>>>> # Lazyboy examples
>>>>>>>> #
>>>>>>>> # © 2009 Digg, Inc. All rights reserved.
>>>>>>>> # Author: Ian Eure <ia...@digg.com>
>>>>>>>> #
>>>>>>>> # This example assumes the following schema:
>>>>>>>> #
>>>>>>>> # <Tables>
>>>>>>>> #     <Table Name="UserData">
>>>>>>>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
>>>>>>>> #     </Table>
>>>>>>>> # </Tables>
>>>>>>>> #
>>>>>>>>
>>>>>>>>
>>>>>>>> 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 = {'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 = ('username',)
>>>>>>>>
>>>>>>>>
>>>>>>>> # Create an empty object
>>>>>>>> u = User()
>>>>>>>>
>>>>>>>> # A PrimaryKey is generated for you:
>>>>>>>> print u.pk
>>>>>>>> # -> {'table': 'UserData', 'superkey': None,
>>>>>>>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
>>>>>>>> #     'family': 'Users', 'supercol': None}
>>>>>>>>
>>>>>>>> data = {'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] = data[k]
>>>>>>>>
>>>>>>>> # Arguments to __init__ are passed to update()
>>>>>>>> u = 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_ = 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
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>>
>> --
>> Evan Weaver
>>


Re: Newbe´s question

Posted by Bruno Couto <bc...@gmail.com>.
Drew,

As I said earlier, I am in my first steps with Cassandra, but I will
use your branch and notify my experiences.

Thanks,
Bruno Couto.


On Mon, Aug 24, 2009 at 7:15 PM, Drew Schleck<dr...@gmail.com> wrote:
> I've been working on a Lazyboy 0.4 update at
> http://github.com/dschleck/lazyboy/ . Right now it's at the point
> where it works for me and what I'm doing but there's probably a few
> bugs to be caught. As an example, yesterday I noticed it wasn't
> possible to delete items out of supercolumns so I fixed that.
>
> If you decide to use my branch of it and find a bug, please tell me
> about it and I'll do my best to sort it out.
>
> Drew
>
> On Mon, Aug 24, 2009 at 12:09, Evan Weaver<ew...@gmail.com> wrote:
>> The Ruby client works fine. ;-)
>>
>> Evan
>>
>> On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<jb...@gmail.com> wrote:
>>> That's probably the best option at the moment.  Once you're familiar
>>> with the thrift API I'm sure the lazyboy devs would welcome updates
>>> too.
>>>
>>> -Jonathan
>>>
>>> On Mon, Aug 24, 2009 at 1:54 PM, Bruno Couto<bc...@gmail.com> wrote:
>>>> Thanks for helpping me Jonathan!
>>>>
>>>> Well, now I know that I can´t use the Lazyboy, then I will try my
>>>> first steps using the Cassandra trunk version and thrift api whitout a
>>>> wrapper.
>>>>
>>>>
>>>> On Mon, Aug 24, 2009 at 2:41 PM, Jonathan Ellis<jb...@gmail.com> wrote:
>>>>> 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<bc...@gmail.com> wrote:
>>>>>> Jonathan,
>>>>>>
>>>>>>
>>>>>> First, thanks for answering so fast.
>>>>>> I´m 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<jb...@gmail.com> wrote:
>>>>>>> There's two things going on here, I think.
>>>>>>>
>>>>>>> One is that you're passing a null where there shouldn't be one.  This
>>>>>>> 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<bc...@gmail.com> 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´m 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.java:284)
>>>>>>>>        at org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
>>>>>>>>        at org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
>>>>>>>>        at org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
>>>>>>>>        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
>>>>>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
>>>>>>>>    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 func
>>>>>>>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_insert
>>>>>>>>
>>>>>>>> ----
>>>>>>>>
>>>>>>>> ColumnFamily.py
>>>>>>>>
>>>>>>>> # -*- coding: utf-8 -*-
>>>>>>>> #
>>>>>>>> # Lazyboy examples
>>>>>>>> #
>>>>>>>> # © 2009 Digg, Inc. All rights reserved.
>>>>>>>> # Author: Ian Eure <ia...@digg.com>
>>>>>>>> #
>>>>>>>> # This example assumes the following schema:
>>>>>>>> #
>>>>>>>> # <Tables>
>>>>>>>> #     <Table Name="UserData">
>>>>>>>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
>>>>>>>> #     </Table>
>>>>>>>> # </Tables>
>>>>>>>> #
>>>>>>>>
>>>>>>>>
>>>>>>>> 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 = {'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 = ('username',)
>>>>>>>>
>>>>>>>>
>>>>>>>> # Create an empty object
>>>>>>>> u = User()
>>>>>>>>
>>>>>>>> # A PrimaryKey is generated for you:
>>>>>>>> print u.pk
>>>>>>>> # -> {'table': 'UserData', 'superkey': None,
>>>>>>>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
>>>>>>>> #     'family': 'Users', 'supercol': None}
>>>>>>>>
>>>>>>>> data = {'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] = data[k]
>>>>>>>>
>>>>>>>> # Arguments to __init__ are passed to update()
>>>>>>>> u = 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_ = 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
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>>
>> --
>> Evan Weaver
>>
>

Re: Newbe´s question

Posted by Drew Schleck <dr...@gmail.com>.
I've been working on a Lazyboy 0.4 update at
http://github.com/dschleck/lazyboy/ . Right now it's at the point
where it works for me and what I'm doing but there's probably a few
bugs to be caught. As an example, yesterday I noticed it wasn't
possible to delete items out of supercolumns so I fixed that.

If you decide to use my branch of it and find a bug, please tell me
about it and I'll do my best to sort it out.

Drew

On Mon, Aug 24, 2009 at 12:09, Evan Weaver<ew...@gmail.com> wrote:
> The Ruby client works fine. ;-)
>
> Evan
>
> On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<jb...@gmail.com> wrote:
>> That's probably the best option at the moment.  Once you're familiar
>> with the thrift API I'm sure the lazyboy devs would welcome updates
>> too.
>>
>> -Jonathan
>>
>> On Mon, Aug 24, 2009 at 1:54 PM, Bruno Couto<bc...@gmail.com> wrote:
>>> Thanks for helpping me Jonathan!
>>>
>>> Well, now I know that I can´t use the Lazyboy, then I will try my
>>> first steps using the Cassandra trunk version and thrift api whitout a
>>> wrapper.
>>>
>>>
>>> On Mon, Aug 24, 2009 at 2:41 PM, Jonathan Ellis<jb...@gmail.com> wrote:
>>>> 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<bc...@gmail.com> wrote:
>>>>> Jonathan,
>>>>>
>>>>>
>>>>> First, thanks for answering so fast.
>>>>> I´m 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<jb...@gmail.com> wrote:
>>>>>> There's two things going on here, I think.
>>>>>>
>>>>>> One is that you're passing a null where there shouldn't be one.  This
>>>>>> 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<bc...@gmail.com> 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´m 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.java:284)
>>>>>>>        at org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
>>>>>>>        at org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
>>>>>>>        at org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
>>>>>>>        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
>>>>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
>>>>>>>    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 func
>>>>>>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_insert
>>>>>>>
>>>>>>> ----
>>>>>>>
>>>>>>> ColumnFamily.py
>>>>>>>
>>>>>>> # -*- coding: utf-8 -*-
>>>>>>> #
>>>>>>> # Lazyboy examples
>>>>>>> #
>>>>>>> # © 2009 Digg, Inc. All rights reserved.
>>>>>>> # Author: Ian Eure <ia...@digg.com>
>>>>>>> #
>>>>>>> # This example assumes the following schema:
>>>>>>> #
>>>>>>> # <Tables>
>>>>>>> #     <Table Name="UserData">
>>>>>>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
>>>>>>> #     </Table>
>>>>>>> # </Tables>
>>>>>>> #
>>>>>>>
>>>>>>>
>>>>>>> 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 = {'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 = ('username',)
>>>>>>>
>>>>>>>
>>>>>>> # Create an empty object
>>>>>>> u = User()
>>>>>>>
>>>>>>> # A PrimaryKey is generated for you:
>>>>>>> print u.pk
>>>>>>> # -> {'table': 'UserData', 'superkey': None,
>>>>>>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
>>>>>>> #     'family': 'Users', 'supercol': None}
>>>>>>>
>>>>>>> data = {'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] = data[k]
>>>>>>>
>>>>>>> # Arguments to __init__ are passed to update()
>>>>>>> u = 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_ = 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
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
>
>
> --
> Evan Weaver
>

Re: Newbe´s question

Posted by Evan Weaver <ew...@gmail.com>.
The Ruby client works fine. ;-)

Evan

On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<jb...@gmail.com> wrote:
> That's probably the best option at the moment.  Once you're familiar
> with the thrift API I'm sure the lazyboy devs would welcome updates
> too.
>
> -Jonathan
>
> On Mon, Aug 24, 2009 at 1:54 PM, Bruno Couto<bc...@gmail.com> wrote:
>> Thanks for helpping me Jonathan!
>>
>> Well, now I know that I can´t use the Lazyboy, then I will try my
>> first steps using the Cassandra trunk version and thrift api whitout a
>> wrapper.
>>
>>
>> On Mon, Aug 24, 2009 at 2:41 PM, Jonathan Ellis<jb...@gmail.com> wrote:
>>> 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<bc...@gmail.com> wrote:
>>>> Jonathan,
>>>>
>>>>
>>>> First, thanks for answering so fast.
>>>> I´m 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<jb...@gmail.com> wrote:
>>>>> There's two things going on here, I think.
>>>>>
>>>>> One is that you're passing a null where there shouldn't be one.  This
>>>>> 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<bc...@gmail.com> 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´m 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.java:284)
>>>>>>        at org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
>>>>>>        at org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
>>>>>>        at org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
>>>>>>        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
>>>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
>>>>>>    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 func
>>>>>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_insert
>>>>>>
>>>>>> ----
>>>>>>
>>>>>> ColumnFamily.py
>>>>>>
>>>>>> # -*- coding: utf-8 -*-
>>>>>> #
>>>>>> # Lazyboy examples
>>>>>> #
>>>>>> # © 2009 Digg, Inc. All rights reserved.
>>>>>> # Author: Ian Eure <ia...@digg.com>
>>>>>> #
>>>>>> # This example assumes the following schema:
>>>>>> #
>>>>>> # <Tables>
>>>>>> #     <Table Name="UserData">
>>>>>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
>>>>>> #     </Table>
>>>>>> # </Tables>
>>>>>> #
>>>>>>
>>>>>>
>>>>>> 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 = {'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 = ('username',)
>>>>>>
>>>>>>
>>>>>> # Create an empty object
>>>>>> u = User()
>>>>>>
>>>>>> # A PrimaryKey is generated for you:
>>>>>> print u.pk
>>>>>> # -> {'table': 'UserData', 'superkey': None,
>>>>>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
>>>>>> #     'family': 'Users', 'supercol': None}
>>>>>>
>>>>>> data = {'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] = data[k]
>>>>>>
>>>>>> # Arguments to __init__ are passed to update()
>>>>>> u = 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_ = 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
>>>>>>
>>>>>
>>>>
>>>
>>
>



-- 
Evan Weaver

Re: Newbe´s question

Posted by Jonathan Ellis <jb...@gmail.com>.
That's probably the best option at the moment.  Once you're familiar
with the thrift API I'm sure the lazyboy devs would welcome updates
too.

-Jonathan

On Mon, Aug 24, 2009 at 1:54 PM, Bruno Couto<bc...@gmail.com> wrote:
> Thanks for helpping me Jonathan!
>
> Well, now I know that I can´t use the Lazyboy, then I will try my
> first steps using the Cassandra trunk version and thrift api whitout a
> wrapper.
>
>
> On Mon, Aug 24, 2009 at 2:41 PM, Jonathan Ellis<jb...@gmail.com> wrote:
>> 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<bc...@gmail.com> wrote:
>>> Jonathan,
>>>
>>>
>>> First, thanks for answering so fast.
>>> I´m 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<jb...@gmail.com> wrote:
>>>> There's two things going on here, I think.
>>>>
>>>> One is that you're passing a null where there shouldn't be one.  This
>>>> 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<bc...@gmail.com> 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´m 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.java:284)
>>>>>        at org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
>>>>>        at org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
>>>>>        at org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
>>>>>        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
>>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
>>>>>    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 func
>>>>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_insert
>>>>>
>>>>> ----
>>>>>
>>>>> ColumnFamily.py
>>>>>
>>>>> # -*- coding: utf-8 -*-
>>>>> #
>>>>> # Lazyboy examples
>>>>> #
>>>>> # © 2009 Digg, Inc. All rights reserved.
>>>>> # Author: Ian Eure <ia...@digg.com>
>>>>> #
>>>>> # This example assumes the following schema:
>>>>> #
>>>>> # <Tables>
>>>>> #     <Table Name="UserData">
>>>>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
>>>>> #     </Table>
>>>>> # </Tables>
>>>>> #
>>>>>
>>>>>
>>>>> 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 = {'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 = ('username',)
>>>>>
>>>>>
>>>>> # Create an empty object
>>>>> u = User()
>>>>>
>>>>> # A PrimaryKey is generated for you:
>>>>> print u.pk
>>>>> # -> {'table': 'UserData', 'superkey': None,
>>>>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
>>>>> #     'family': 'Users', 'supercol': None}
>>>>>
>>>>> data = {'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] = data[k]
>>>>>
>>>>> # Arguments to __init__ are passed to update()
>>>>> u = 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_ = 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
>>>>>
>>>>
>>>
>>
>

Re: Newbe´s question

Posted by Bruno Couto <bc...@gmail.com>.
Thanks for helpping me Jonathan!

Well, now I know that I can´t use the Lazyboy, then I will try my
first steps using the Cassandra trunk version and thrift api whitout a
wrapper.


On Mon, Aug 24, 2009 at 2:41 PM, Jonathan Ellis<jb...@gmail.com> wrote:
> 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<bc...@gmail.com> wrote:
>> Jonathan,
>>
>>
>> First, thanks for answering so fast.
>> I´m 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<jb...@gmail.com> wrote:
>>> There's two things going on here, I think.
>>>
>>> One is that you're passing a null where there shouldn't be one.  This
>>> 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<bc...@gmail.com> 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´m 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.java:284)
>>>>        at org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
>>>>        at org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
>>>>        at org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
>>>>        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
>>>>    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 func
>>>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_insert
>>>>
>>>> ----
>>>>
>>>> ColumnFamily.py
>>>>
>>>> # -*- coding: utf-8 -*-
>>>> #
>>>> # Lazyboy examples
>>>> #
>>>> # © 2009 Digg, Inc. All rights reserved.
>>>> # Author: Ian Eure <ia...@digg.com>
>>>> #
>>>> # This example assumes the following schema:
>>>> #
>>>> # <Tables>
>>>> #     <Table Name="UserData">
>>>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
>>>> #     </Table>
>>>> # </Tables>
>>>> #
>>>>
>>>>
>>>> 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 = {'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 = ('username',)
>>>>
>>>>
>>>> # Create an empty object
>>>> u = User()
>>>>
>>>> # A PrimaryKey is generated for you:
>>>> print u.pk
>>>> # -> {'table': 'UserData', 'superkey': None,
>>>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
>>>> #     'family': 'Users', 'supercol': None}
>>>>
>>>> data = {'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] = data[k]
>>>>
>>>> # Arguments to __init__ are passed to update()
>>>> u = 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_ = 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
>>>>
>>>
>>
>

Re: Newbe´s question

Posted by Jonathan Ellis <jb...@gmail.com>.
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<bc...@gmail.com> wrote:
> Jonathan,
>
>
> First, thanks for answering so fast.
> I´m 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<jb...@gmail.com> wrote:
>> There's two things going on here, I think.
>>
>> One is that you're passing a null where there shouldn't be one.  This
>> 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<bc...@gmail.com> 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´m 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.java:284)
>>>        at org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
>>>        at org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
>>>        at org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
>>>        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
>>>    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 func
>>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_insert
>>>
>>> ----
>>>
>>> ColumnFamily.py
>>>
>>> # -*- coding: utf-8 -*-
>>> #
>>> # Lazyboy examples
>>> #
>>> # © 2009 Digg, Inc. All rights reserved.
>>> # Author: Ian Eure <ia...@digg.com>
>>> #
>>> # This example assumes the following schema:
>>> #
>>> # <Tables>
>>> #     <Table Name="UserData">
>>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
>>> #     </Table>
>>> # </Tables>
>>> #
>>>
>>>
>>> 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 = {'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 = ('username',)
>>>
>>>
>>> # Create an empty object
>>> u = User()
>>>
>>> # A PrimaryKey is generated for you:
>>> print u.pk
>>> # -> {'table': 'UserData', 'superkey': None,
>>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
>>> #     'family': 'Users', 'supercol': None}
>>>
>>> data = {'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] = data[k]
>>>
>>> # Arguments to __init__ are passed to update()
>>> u = 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_ = 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
>>>
>>
>

Re: Newbe´s question

Posted by Bruno Couto <bc...@gmail.com>.
Jonathan,


First, thanks for answering so fast.
I´m 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<jb...@gmail.com> wrote:
> There's two things going on here, I think.
>
> One is that you're passing a null where there shouldn't be one.  This
> 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<bc...@gmail.com> 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´m 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.java:284)
>>        at org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
>>        at org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
>>        at org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
>>        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
>>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
>>    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 func
>> lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_insert
>>
>> ----
>>
>> ColumnFamily.py
>>
>> # -*- coding: utf-8 -*-
>> #
>> # Lazyboy examples
>> #
>> # © 2009 Digg, Inc. All rights reserved.
>> # Author: Ian Eure <ia...@digg.com>
>> #
>> # This example assumes the following schema:
>> #
>> # <Tables>
>> #     <Table Name="UserData">
>> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
>> #     </Table>
>> # </Tables>
>> #
>>
>>
>> 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 = {'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 = ('username',)
>>
>>
>> # Create an empty object
>> u = User()
>>
>> # A PrimaryKey is generated for you:
>> print u.pk
>> # -> {'table': 'UserData', 'superkey': None,
>> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
>> #     'family': 'Users', 'supercol': None}
>>
>> data = {'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] = data[k]
>>
>> # Arguments to __init__ are passed to update()
>> u = 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_ = 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
>>
>

Re: Newbe´s question

Posted by Jonathan Ellis <jb...@gmail.com>.
There's two things going on here, I think.

One is that you're passing a null where there shouldn't be one.  This
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<bc...@gmail.com> 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´m 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.java:284)
>        at org.apache.cassandra.service.CassandraServer.batch_insert(CassandraServer.java:318)
>        at org.apache.cassandra.service.Cassandra$Processor$batch_insert.process(Cassandra.java:968)
>        at org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:807)
>        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:252)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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 <module>
>    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 func
> lazyboy.exceptions.ErrorThriftMessage: Internal error processing batch_insert
>
> ----
>
> ColumnFamily.py
>
> # -*- coding: utf-8 -*-
> #
> # Lazyboy examples
> #
> # © 2009 Digg, Inc. All rights reserved.
> # Author: Ian Eure <ia...@digg.com>
> #
> # This example assumes the following schema:
> #
> # <Tables>
> #     <Table Name="UserData">
> #         <ColumnFamily ColumnSort="Name" Name="Users"/>
> #     </Table>
> # </Tables>
> #
>
>
> 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 = {'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 = ('username',)
>
>
> # Create an empty object
> u = User()
>
> # A PrimaryKey is generated for you:
> print u.pk
> # -> {'table': 'UserData', 'superkey': None,
> #     'key': 'da6c8e19174f40cfa6d0b65a08eef62f',
> #     'family': 'Users', 'supercol': None}
>
> data = {'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] = data[k]
>
> # Arguments to __init__ are passed to update()
> u = 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_ = 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
>