I have several hundred keys, all from the same model that I previously calculated:
candidate_keys = [db.Key(...), db.Key(...), db.Key(...), ...]
Some of these keys relate to the actual objects in the data warehouse, and some do not. I want to determine which keys correspond to objects.
There is no need to know the data inside the objects, only they exist.
One solution would be to use db.get ():
keys_with_entities = set()
for entity in db.get(candidate_keys):
if entity:
keys_with_entities.add(entity.key())
However, this procedure will retrieve all entity data from the store, which is not necessary and expensive.
The second idea is to use Query with a filter INon key_name, manually selecting 30 in pieces to match the requirements of a pseudo-filter IN. However, filtering INdoes not allow key-only requests.Is there a better way?