I have some keys and the only thing I want to know is if there is a matching entity in datastore. currently I'm doing:
entities = db.get(keys)
for entity in entities:
if entity:
# some stuff
else:
# some other stuff
While this works, I just need a boolean to be passed, not the entier object. Is there a way to make this bit of code a bit cheaper?
Compare the speed of what you're doing now against querying the keys one-at-a-time using a keys-only query. If there isn't a clear winner, take the keys-only query, since it costs less.