The Google AppEngine NDB Documentation for map() states that:
"All query options keyword arguments are supported."
However, I have tried to use produces_cursors=True
on map()
and I'm not getting a cursor back.
map(callback, pass_batch_into_callback=None, merge_future=None, **q_options)
I'd like to use map()
as I can set the callback to a tasklet.
https://developers.google.com/appengine/docs/python/ndb/queryclass#kwdargs_options
Edit - Providing code sample:
@ndb.tasklet
def callback(user):
statistics = yield ndb.Key(Statistics, user.key.id()).get_async()
raise ndb.Return(user, statistics)
result = User.query().map(callback, produces_cursors=True)
The example seems to have a typo -- the correct flag is produce_cursors
, not produces_cursors
.
But cursors are only made available when you use an iterator, not with map()
. Check out the async iterators example; it's a little bit of work but you can definitely use it to manually create a tasklet for each result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With