保存到 cassandra 时出现 Lazyboy AttributeError
嘿,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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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).