该代码在本地主机上运行良好
但是,当我将其上传到GAE时,却不断出现错误:
NeedIndexError: no matching index found.
The suggested index for this query is:
- kind: DataModel
properties:
- name: __key__
direction: desc
我搜索到错误是由未更新的索引引起的,所以我等待了2天。但是仍然出现错误。
我怀疑我使用了三个不同的命令:
DataModel.query(DataModel.key <= ndb.Key('DataModel',continuity_checked_id)).order(
-DataModel.key).fetch(2001)
DataModel.query().order(-DataModel.date, -DataModel.times)
DataModel.query(DataModel.key >= ndb.Key("DataModel", last_checked_DataModel)).order(DataModel.key).fetch()
我该如何解决这个问题?
如错误消息所示,您需要为尝试运行的查询创建索引。也请参考:https : //cloud.google.com/appengine/docs/python/config/indexconfig
indexes:
- kind: DataModel
properties:
- name: __key__
direction: desc
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句