Given a Key that I construct, I would like to hit the datastore to see if it exists, but I want the cheapest (in time) way to do that. What I am looking for is like a keys only query but from get, e.g. my_key.get(keys_only=True). Does such an animal exist? It doesn’t look like it to me. If not, is there some other way to achieve what I am after?
Thanks.
No, this functionality does not exist. Since not all entities are indexed, there is no shortcut — the only way to test whether the key exists is to try to get it, and then you have the entity data available to you for free (in terms of disk operations anyway — there’s a bit of serialization cost but we’re not charging for that).
PS. Are you sure you aren’t trying to optimize prematurely?