保存到 cassandra 时出现 Lazyboy AttributeError

发布于 2024-12-05 07:03:40 字数 1555 浏览 8 评论 0原文

嘿,stackoverflow comm,

我正在尝试写入我的木薯数据库,但是有些事情正在 错误..一些数据:我在Ubuntu(11.04)上使用Python 2.7,Cassandra 0.8.4和Lazyboy 0.7.5。虽然我想写信给卡桑德拉,但我得到的

Traceback (most recent call last):
File "/home/kq/protoWorkspace/indexer/src/database.py", line 40, in <module>
w.save()
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'

是我的实际来源:

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()

有什么想法,我在做什么错? :)

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.save()
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?
:)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小帐篷 2024-12-12 07:03:40

Mainline Lazyboy仅支持Cassandra 0.6。我建议使用 pycassa 而不是。 Pycassa由DataStax维护,并完全支持最新的Cassandra功能。

如果您必须使用lazyboy,则有一个 fork 支持Cassandra 0.7(与0.8兼容),但要开发看起来不太活跃(5月的最后更新)。

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文