开发者

Lazyboy AttributeError while saving to cassandra

Hey Stackoverflow comm,

I'm trying to write to my cassandra database but something is going wrong.. Some datas: I'm using Python 2.7 on Ubuntu (11.04), cassandra 0.8.4 and lazyboy 0.7.5. While I want to write to cassandra I get

Traceback (most recent call last):
File "/home/kq/protoWorkspace/indexer/src/database.py", line 40, in <module>
w.s开发者_如何学Goave()
File "/usr/local/lib/python2.7/dist-packages/Lazyboy-0.7.5-py2.7.egg/lazyboy/record.py",         
line 202, in save
self._save_internal(self.key, changes, consistency)
File "/usr/local/lib/python2.7/dist-packages/Lazyboy-0.7.5-py2.7.egg/lazyboy/record.py",         
line 236, in _save_internal
key, changes['changed'], consistency))
File "/usr/local/lib/python2.7/dist-packages/Lazyboy-0.7.5-py2.7.egg/lazyboy/connection.py", line 53, in __inner__
raise ex

AttributeError: 'Client' object has no attribute 'batch_insert'

This is my actual source:

from lazyboy import *
from lazyboy.key import Key

connection.add_pool('indexer', ['localhost:9160'])

class Indexx(Key):
    def __init__(self, *args, **kwargs):
        Key.__init__(self, "indexer", "indexx", key)

class Word(record.Record):
    _required = ('word', 'docID', 'count',)

    def __init__(self, *args, **kwargs):
        record.Record.__init__(self, *args, **kwargs)
        self.key = Indexx()

w = Word()

print w.key

data = {'word'  : 'test',
        'docID' : 'docId-TEST',
        'count' : 42}

w.update(data)
w.update(data.items())
w.update(**data)
for k in data:
    w[k] = data[k]

w_ = Word(data)
print w_

print w.is_modified()
w.save()

Any ideas, what I am doing wrong? :)


Mainline lazyboy only supports Cassandra 0.6. I recommend using pycassa instead. Pycassa is maintained by DataStax and fully supports the latest Cassandra features.

If you must use lazyboy, there is a fork that supports Cassandra 0.7 (which is compatible with 0.8) but development does not look very active (last update in May).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜