Reputation: 3535
I can't understand if this is possible or not.
I need to retrieve all the entities of kind "A", children of a list of entities of kind "B".
So there are multiple children "A" for each entity "B".
This would be easy: i get B-list, the list of entities of kind "B" that i need and for each, i get the list of childrens.
Now, i could sort them after the query, merging them in a single list even if it's not a good practice. My biggest problem is that i don't know how to use a cursor because there are multiple queries.
Then i think i need something that looks like
A.query(ancestor in B-list).fetch(...)
but i can't understand how i can do that or what i should use.
Upvotes: 1
Views: 1373
Reputation: 16890
You can only specify one query per ancestor. So you'll have to do multiple queries. But if you're a little clever you can do them in parallel. Here's a rough sketch of the code (untested):
futures = []
for b in B_list:
futures.append(A.query(ancestor=b).fetch_async(...))
results = []
for f in futures:
results.extend(f.get_result())
Upvotes: 5