I am seeking for advice, how I can improve this in terms of speed:
My Data-model:
class Events(ndb.Model):
eventid = ndb.StringProperty(required=True)
participants = ndb.StringProperty(repeated=True)
The way I try to get the data:
def GetEventDataNotCached(eventslist):
futures = []
for eventid in eventslist:
if eventid is not None:
ke = database.Events.query(database.Events.eventid == eventid)
future = ke.get_async(keys_only = True)
futures.append(future)
eventskeys = []
for future in futures:
eventkey = future.get_result()
eventskeys.append(eventkey)
data = ndb.get_multi(eventskeys)
So I get the keys async and than pass the keys to a "get_multi" - is there any other way to make that faster, as I am still not happy yet with the performance.
In the repeated property there can be up to a couple of hundred strings. There are several 10.000 rows in the Events model. In the eventslist are just a couple of dozens eventids I want to fetch.