저는 cqlengine을 사용하여 파이썬에서 Cassandra와 작업하기 시작했습니다.CqlEngine - sync_table() KeyError : 'cqlengine'
나는이 link 다음 시도하고 노력이 스크립트 실행 :
from cqlengine import columns
from cqlengine import Model
from cqlengine import connection
from cqlengine.management import sync_table
import uuid
class ExampleModel(Model):
example_id = columns.UUID(primary_key=True, default=uuid.uuid4)
example_type = columns.Integer(index=True)
created_at = columns.DateTime()
description = columns.Text(required=False)
connection.setup(['127.0.0.1'], 'cqlengine')
sync_table(ExampleModel)
을하지만이 오류 던졌습니다 :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zopper/Desktop/django-cassandra/local/lib/python2.7/site-packages/cqlengine/management.py", line 92, in sync_table
keyspace = cluster.metadata.keyspaces[ks_name]
KeyError: 'cqlengine'
내 pip freeze
은 다음과 같습니다
Django==1.7.3
argparse==1.2.1
blist==1.3.6
cassandra-driver==2.1.3
cqlengine==0.21.0
django-cassandra-engine==0.2.1
djangotoolbox==1.6.2
futures==2.2.0
six==1.9.0
wsgiref==0.1.2
는 제발 도와주세요 이 문제를 이해하고 해결하십시오. 감사합니다. .
그래서 소스에서 패키지를 다시 설치합니까? GitHub에서? –
create_keyspace()를 사용하여 수동으로 키 공간을 생성해야합니다. sync_table의 create_missing_keyspace 인수가 없어졌습니다. 나는 readme를 업데이트했다 : https://github.com/cqlengine/cqlengine/blob/master/README.md –
그래, 고마워. 나는 그것을 알아 냈다. :) –