Python 如何在Datastore Plus(NDB)中查询Model.KeyProperty==None

Python 如何在Datastore Plus(NDB)中查询Model.KeyProperty==None,python,google-app-engine,google-cloud-datastore,Python,Google App Engine,Google Cloud Datastore,假设NDB(版本0.7和0.8)模型的密钥可以为None: class Test(model.Model): k = model.KeyProperty() value = model.IntegerProperty() count = Test.query(Test.k == None).count() # error #count = Test.query(Test.k != None).count() # error also 只有无的筛选键才会抛出错误 File

假设NDB(版本0.7和0.8)模型的密钥可以为None:

class Test(model.Model):
    k = model.KeyProperty()
    value = model.IntegerProperty()

 count = Test.query(Test.k == None).count() # error
 #count = Test.query(Test.k != None).count() # error also
只有无的筛选键才会抛出错误

File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
    handler.get(*groups)
File "/Users/reiot/Documents/Works/ndbtest/main.py", line 91, in get
    count = Test.query(Test.k == None).count() # error
File "/Users/reiot/Documents/Works/ndbtest/ndb/model.py", line 500, in __eq__
    return self._comparison('=', value)
File "/Users/reiot/Documents/Works/ndbtest/ndb/model.py", line 491, in _comparison
    return FilterNode(self._name, op, self._datastore_type(value))
File "/Users/reiot/Documents/Works/ndbtest/ndb/model.py", line 1138, in _datastore_type
    return datastore_types.Key(value.urlsafe())
AttributeError: 'NoneType' object has no attribute 'urlsafe'

如何在没有的情况下查询KeyProperty?

这看起来像NDB中的一个bug。你能在问题追踪器上提交一份吗?

好的。我登记在:)