Could not find this specific question asked before yet. How does App Engine\'s NDB handle caching when using projected queries vs. full entity queries?
For example,
As far as I'm aware, query results are only cached in in-context cache, but results are not fetched from cache for queries.
key.get() will be cached and retrieved from cache, but query.get() won't be retrieved from cache.
https://developers.google.com/appengine/docs/python/ndb/cache
From the docs: Queries do not look up values in any cache. However, query results are written back to the in-context cache if the cache policy says so (but never to Memcache).
To answer the question regarding what you'll be getting, in both queries it appears that the results will be fetched from the datastore and not from cache.
Projection query results are never cached. It would not be right if a get by key were to ever return a projection result. So no worries.