简体   繁体   中英

Can't Query by Key in NDB

I'm attempting to query an entity by key assuming ordering by key with ndb.

the line is

query = User.query().filter(User.key > ndb.Key('User', key_id))

and it's throwing a server error:

  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore_types.py", line 1443, in ValidatePropertyKey
'Incomplete key found for reference property %s.' % name)
BadValueError: Incomplete key found for reference property __key__.

Is it just that I'm not allowed to query by key in this way? Other stack overflow posts seem to indicate that what i'm doing should be ok. I can't find anything online pertaining to the error text, and i'm not sure what else would be causing this error.

Any help or insight is greatly appreciated.

尝试这个

query = User.query().filter(User._key > ndb.Key('User', key_id))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM