我想通过它的 django 模型创建一个包含两个 primary_key 的表,如下所示:
class UserView(Model):
email= columns.Text(primary_key=True)
entryLink= columns.Text(primary_key=True)
date= columns.Date(default=datetime.date.today())
但是当我想创建如下表时:
>>> from cqlengine import connection
>>> from cqlengine.management import create_table
>>> from MainAPP.models import UserView
>>> connection.setup(['127.0.0.1:9160'])
>>> create_table(UserView)
我看到这个错误:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "H:\Web-Programming\Python\Project\Prexter\Virtual-Environment\Lib\site-packages\cqlengine\management.py", line 97, in create_table
execute(qs)
File "H:\Web-Programming\Python\Project\Prexter\Virtual-Environment\Lib\site-packages\cqlengine\connection.py", line 172, in execute
return connection_pool.execute(query, params)
File "H:\Web-Programming\Python\Project\Prexter\Virtual-Environment\Lib\site-packages\cqlengine\connection.py", line 164, in execute
raise CQLEngineException(unicode(ex))
CQLEngineException: Bad Request: Missing CLUSTERING ORDER for column entryLink
当我从entryLink字段中删除primary_key属性时,我没有错误!但我想将 entryLink 定义为 primary_key!我的错误是什么?