Hey Stackoverflow comm,
我正在尝试写入我的cassandra数据库,但事情正在发生 错误..一些数据:我在Ubuntu(11.04)上使用Python 2.7,cassandra 0.8.4和lazyboy 0.7.5。虽然我想写信给cassandra但我得到了
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()
任何想法,我做错了什么? :)