Can't Query by Key in NDB
<p>I'm attempting to query an entity by key assuming ordering by key with ndb.</p>

<p>the line is</p>

<pre><code>query = User.query().filter(User.key &gt; ndb.Key('User', key_id))
</code></pre>

<p>and it's throwing a server error: </p>

<pre><code>  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__.
</code></pre>

<p>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.</p>

<p>Any help or insight is greatly appreciated.</p>

<p>Try this</p>

<pre><code>query = User.query().filter(User._key &gt; ndb.Key('User', key_id))
</code></pre>

python google-app-engine google-cloud-platform app-engine-ndb