我正在尝试使用 cassandra 通过 kafka 连接 Meetup 流 api。cqlengine
似乎它以前是一个单独的项目,而我使用的参考代码是在那个时候制作的。
所以以前,cqlengine.management
有create_keyspace
现在,cassandra.cqlengine.management
有create_keyspace_simple
我正在尝试创建键空间。
create_keyspace_simple('meetup', 'SimpleStrategy', 1)
但是,然后我得到了这个错误。警告:
/Users/a/anaconda/lib/python2.7/site-packages/cassandra/cqlengine/management.py:419:UserWarning:CQLENG_ALLOW_SCHEMA_MANAGEMENT 环境变量未设置。此软件包的未来版本将需要此变量来启用管理功能。
警告。警告(味精)
错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-17-45553511338c> in <module>()
1 # create keyspace
2 # keyspace name, keyspace replication strategy, replication factor
----> 3 create_keyspace_simple('meetup', 'SimpleStrategy', 1)
/Users/a/anaconda/lib/python2.7/site-packages/cassandra/cqlengine/management.pyc in create_keyspace_simple(name, replication_factor, durable_writes)
54 """
55 _create_keyspace(name, durable_writes, 'SimpleStrategy',
---> 56 {'replication_factor': replication_factor})
57
58
/Users/a/anaconda/lib/python2.7/site-packages/cassandra/cqlengine/management.pyc in _create_keyspace(name, durable_writes, strategy_class, strategy_options)
84 log.info("Creating keyspace %s ", name)
85 ks_meta = metadata.KeyspaceMetadata(name, durable_writes, strategy_class, strategy_options)
---> 86 execute(ks_meta.as_cql_query())
87 else:
88 log.info("Not creating keyspace %s because it already exists", name)
/Users/a/anaconda/lib/python2.7/site-packages/cassandra/metadata.so in cassandra.metadata.KeyspaceMetadata.as_cql_query (cassandra/metadata.c:17371)()
AttributeError: 'NoneType' object has no attribute 'export_for_schema'