Newbe´s question

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Newbe´s question

Bruno Couto
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': '[hidden email]'}
True
Traceback (most recent call last):
  File "columnfamily.py", line 65, in <module>
    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
  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 <[hidden email]>
#
# 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': '[hidden email]'}

# 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': '[hidden email]'}

# You can see if it's been modified.
print u.is_modified()           # -> True

# Save to Cassandra
u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}

print u.is_modified()           # -> False

# Load it in a new instance.
u_ = User().load(u.pk.key)
print u_           # -> {'username': 'ieure', 'email': '[hidden email]'}

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
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Jonathan Ellis-3
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<[hidden email]> 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': '[hidden email]'}
> True
> Traceback (most recent call last):
>  File "columnfamily.py", line 65, in <module>
>    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>  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 <[hidden email]>
> #
> # 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': '[hidden email]'}
>
> # 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': '[hidden email]'}
>
> # You can see if it's been modified.
> print u.is_modified()           # -> True
>
> # Save to Cassandra
> u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>
> print u.is_modified()           # -> False
>
> # Load it in a new instance.
> u_ = User().load(u.pk.key)
> print u_           # -> {'username': 'ieure', 'email': '[hidden email]'}
>
> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Bruno Couto
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<[hidden email]> 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<[hidden email]> 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': '[hidden email]'}
>> True
>> Traceback (most recent call last):
>>  File "columnfamily.py", line 65, in <module>
>>    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>  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 <[hidden email]>
>> #
>> # 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': '[hidden email]'}
>>
>> # 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': '[hidden email]'}
>>
>> # You can see if it's been modified.
>> print u.is_modified()           # -> True
>>
>> # Save to Cassandra
>> u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>
>> print u.is_modified()           # -> False
>>
>> # Load it in a new instance.
>> u_ = User().load(u.pk.key)
>> print u_           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>
>> 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
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Jonathan Ellis-3
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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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': '[hidden email]'}
>>> True
>>> Traceback (most recent call last):
>>>  File "columnfamily.py", line 65, in <module>
>>>    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>  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 <[hidden email]>
>>> #
>>> # 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': '[hidden email]'}
>>>
>>> # 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': '[hidden email]'}
>>>
>>> # You can see if it's been modified.
>>> print u.is_modified()           # -> True
>>>
>>> # Save to Cassandra
>>> u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>
>>> print u.is_modified()           # -> False
>>>
>>> # Load it in a new instance.
>>> u_ = User().load(u.pk.key)
>>> print u_           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>
>>> 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
>>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Bruno Couto
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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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': '[hidden email]'}
>>>> True
>>>> Traceback (most recent call last):
>>>>  File "columnfamily.py", line 65, in <module>
>>>>    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>  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 <[hidden email]>
>>>> #
>>>> # 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': '[hidden email]'}
>>>>
>>>> # 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': '[hidden email]'}
>>>>
>>>> # You can see if it's been modified.
>>>> print u.is_modified()           # -> True
>>>>
>>>> # Save to Cassandra
>>>> u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>
>>>> print u.is_modified()           # -> False
>>>>
>>>> # Load it in a new instance.
>>>> u_ = User().load(u.pk.key)
>>>> print u_           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>
>>>> 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
>>>>
>>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Jonathan Ellis-3
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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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': '[hidden email]'}
>>>>> True
>>>>> Traceback (most recent call last):
>>>>>  File "columnfamily.py", line 65, in <module>
>>>>>    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>  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 <[hidden email]>
>>>>> #
>>>>> # 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': '[hidden email]'}
>>>>>
>>>>> # 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': '[hidden email]'}
>>>>>
>>>>> # You can see if it's been modified.
>>>>> print u.is_modified()           # -> True
>>>>>
>>>>> # Save to Cassandra
>>>>> u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>
>>>>> print u.is_modified()           # -> False
>>>>>
>>>>> # Load it in a new instance.
>>>>> u_ = User().load(u.pk.key)
>>>>> print u_           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>
>>>>> 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
>>>>>
>>>>
>>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Evan Weaver
The Ruby client works fine. ;-)

Evan

On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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': '[hidden email]'}
>>>>>> True
>>>>>> Traceback (most recent call last):
>>>>>>  File "columnfamily.py", line 65, in <module>
>>>>>>    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>  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 <[hidden email]>
>>>>>> #
>>>>>> # 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': '[hidden email]'}
>>>>>>
>>>>>> # 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': '[hidden email]'}
>>>>>>
>>>>>> # You can see if it's been modified.
>>>>>> print u.is_modified()           # -> True
>>>>>>
>>>>>> # Save to Cassandra
>>>>>> u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>
>>>>>> print u.is_modified()           # -> False
>>>>>>
>>>>>> # Load it in a new instance.
>>>>>> u_ = User().load(u.pk.key)
>>>>>> print u_           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>
>>>>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Drew Schleck
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<[hidden email]> wrote:

> The Ruby client works fine. ;-)
>
> Evan
>
> On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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': '[hidden email]'}
>>>>>>> True
>>>>>>> Traceback (most recent call last):
>>>>>>>  File "columnfamily.py", line 65, in <module>
>>>>>>>    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>>  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 <[hidden email]>
>>>>>>> #
>>>>>>> # 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': '[hidden email]'}
>>>>>>>
>>>>>>> # 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': '[hidden email]'}
>>>>>>>
>>>>>>> # You can see if it's been modified.
>>>>>>> print u.is_modified()           # -> True
>>>>>>>
>>>>>>> # Save to Cassandra
>>>>>>> u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>>
>>>>>>> print u.is_modified()           # -> False
>>>>>>>
>>>>>>> # Load it in a new instance.
>>>>>>> u_ = User().load(u.pk.key)
>>>>>>> print u_           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>>
>>>>>>> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Chris Goffinet-2
Please send pull requests to Digg, our guys can merge them in.

---
Chris Goffinet
[hidden email]





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<[hidden email]> wrote:
>> The Ruby client works fine. ;-)
>>
>> Evan
>>
>> On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<[hidden email]>  
>> 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<[hidden email]>  
>>> 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<[hidden email]> 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<[hidden email]>  
>>>>> 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<[hidden email]
>>>>>> > 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<[hidden email]>  
>>>>>>> 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': '[hidden email]'}
>>>>>>>> True
>>>>>>>> Traceback (most recent call last):
>>>>>>>>  File "columnfamily.py", line 65, in <module>
>>>>>>>>    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]
>>>>>>>> '}
>>>>>>>>  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 <[hidden email]>
>>>>>>>> #
>>>>>>>> # 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': '[hidden email]'}
>>>>>>>>
>>>>>>>> # 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': '[hidden email]
>>>>>>>> '}
>>>>>>>>
>>>>>>>> # You can see if it's been modified.
>>>>>>>> print u.is_modified()           # -> True
>>>>>>>>
>>>>>>>> # Save to Cassandra
>>>>>>>> u.save()           # -> {'username': 'ieure', 'email': '[hidden email]
>>>>>>>> '}
>>>>>>>>
>>>>>>>> print u.is_modified()           # -> False
>>>>>>>>
>>>>>>>> # Load it in a new instance.
>>>>>>>> u_ = User().load(u.pk.key)
>>>>>>>> print u_           # -> {'username': 'ieure', 'email': '[hidden email]
>>>>>>>> '}
>>>>>>>>
>>>>>>>> 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
>>

Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Bruno Couto
In reply to this post by Drew Schleck
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<[hidden email]> 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<[hidden email]> wrote:
>> The Ruby client works fine. ;-)
>>
>> Evan
>>
>> On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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': '[hidden email]'}
>>>>>>>> True
>>>>>>>> Traceback (most recent call last):
>>>>>>>>  File "columnfamily.py", line 65, in <module>
>>>>>>>>    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>>>  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 <[hidden email]>
>>>>>>>> #
>>>>>>>> # 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': '[hidden email]'}
>>>>>>>>
>>>>>>>> # 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': '[hidden email]'}
>>>>>>>>
>>>>>>>> # You can see if it's been modified.
>>>>>>>> print u.is_modified()           # -> True
>>>>>>>>
>>>>>>>> # Save to Cassandra
>>>>>>>> u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>>>
>>>>>>>> print u.is_modified()           # -> False
>>>>>>>>
>>>>>>>> # Load it in a new instance.
>>>>>>>> u_ = User().load(u.pk.key)
>>>>>>>> print u_           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>>>
>>>>>>>> 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
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

mobiledreamers
In reply to this post by Drew Schleck
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 <[hidden email]> 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<[hidden email]> wrote:
> The Ruby client works fine. ;-)
>
> Evan
>
> On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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': '[hidden email]'}
>>>>>>> True
>>>>>>> Traceback (most recent call last):
>>>>>>>  File "columnfamily.py", line 65, in <module>
>>>>>>>    u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>>  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 <[hidden email]>
>>>>>>> #
>>>>>>> # 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': '[hidden email]'}
>>>>>>>
>>>>>>> # 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': '[hidden email]'}
>>>>>>>
>>>>>>> # You can see if it's been modified.
>>>>>>> print u.is_modified()           # -> True
>>>>>>>
>>>>>>> # Save to Cassandra
>>>>>>> u.save()           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>>
>>>>>>> print u.is_modified()           # -> False
>>>>>>>
>>>>>>> # Load it in a new instance.
>>>>>>> u_ = User().load(u.pk.key)
>>>>>>> print u_           # -> {'username': 'ieure', 'email': '[hidden email]'}
>>>>>>>
>>>>>>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Drew Schleck
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, <[hidden email]> 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 <[hidden email]>
> 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<[hidden email]> wrote:
>> > The Ruby client works fine. ;-)
>> >
>> > Evan
>> >
>> > On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<[hidden email]>
>> > 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<[hidden email]> 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<[hidden email]>
>> >>> 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<[hidden email]>
>> >>>> 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<[hidden email]>
>> >>>>> 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<[hidden email]>
>> >>>>>> 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': '[hidden email]'}
>> >>>>>>> True
>> >>>>>>> Traceback (most recent call last):
>> >>>>>>>  File "columnfamily.py", line 65, in <module>
>> >>>>>>>    u.save()           # -> {'username': 'ieure', 'email':
>> >>>>>>> '[hidden email]'}
>> >>>>>>>  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 <[hidden email]>
>> >>>>>>> #
>> >>>>>>> # 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': '[hidden email]'}
>> >>>>>>>
>> >>>>>>> # 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':
>> >>>>>>> '[hidden email]'}
>> >>>>>>>
>> >>>>>>> # You can see if it's been modified.
>> >>>>>>> print u.is_modified()           # -> True
>> >>>>>>>
>> >>>>>>> # Save to Cassandra
>> >>>>>>> u.save()           # -> {'username': 'ieure', 'email':
>> >>>>>>> '[hidden email]'}
>> >>>>>>>
>> >>>>>>> print u.is_modified()           # -> False
>> >>>>>>>
>> >>>>>>> # Load it in a new instance.
>> >>>>>>> u_ = User().load(u.pk.key)
>> >>>>>>> print u_           # -> {'username': 'ieure', 'email':
>> >>>>>>> '[hidden email]'}
>> >>>>>>>
>> >>>>>>> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Drew Schleck
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<[hidden email]> 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, <[hidden email]> 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 <[hidden email]>
>> 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<[hidden email]> wrote:
>>> > The Ruby client works fine. ;-)
>>> >
>>> > Evan
>>> >
>>> > On Mon, Aug 24, 2009 at 12:00 PM, Jonathan Ellis<[hidden email]>
>>> > 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<[hidden email]> 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<[hidden email]>
>>> >>> 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<[hidden email]>
>>> >>>> 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<[hidden email]>
>>> >>>>> 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<[hidden email]>
>>> >>>>>> 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': '[hidden email]'}
>>> >>>>>>> True
>>> >>>>>>> Traceback (most recent call last):
>>> >>>>>>>  File "columnfamily.py", line 65, in <module>
>>> >>>>>>>    u.save()           # -> {'username': 'ieure', 'email':
>>> >>>>>>> '[hidden email]'}
>>> >>>>>>>  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 <[hidden email]>
>>> >>>>>>> #
>>> >>>>>>> # 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': '[hidden email]'}
>>> >>>>>>>
>>> >>>>>>> # 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':
>>> >>>>>>> '[hidden email]'}
>>> >>>>>>>
>>> >>>>>>> # You can see if it's been modified.
>>> >>>>>>> print u.is_modified()           # -> True
>>> >>>>>>>
>>> >>>>>>> # Save to Cassandra
>>> >>>>>>> u.save()           # -> {'username': 'ieure', 'email':
>>> >>>>>>> '[hidden email]'}
>>> >>>>>>>
>>> >>>>>>> print u.is_modified()           # -> False
>>> >>>>>>>
>>> >>>>>>> # Load it in a new instance.
>>> >>>>>>> u_ = User().load(u.pk.key)
>>> >>>>>>> print u_           # -> {'username': 'ieure', 'email':
>>> >>>>>>> '[hidden email]'}
>>> >>>>>>>
>>> >>>>>>> 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
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Drew Schleck
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
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Ian Eure
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
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Sal Fuentes
Just would like to say great job so far. 

On Wed, Aug 26, 2009 at 4:01 PM, Ian Eure <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Ian Holsman-3
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 <[hidden email]> 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
[hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Jonathan Ellis-3
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<[hidden email]> 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 <[hidden email]> 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
> [hidden email]
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Ian Holsman-3
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<[hidden email]> 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 <[hidden email]> 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
>> [hidden email]
>>
>>
>>
>>

--
Ian Holsman
[hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: Newbe´s question

Eric Evans-4
In reply to this post by Ian Holsman-3
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
[hidden email]

12