您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

python – NDB映射(回调,produce_cursors = True)

5b51 2022/1/14 8:20:49 python 字数 1449 阅读 468 来源 www.jb51.cc/python

map()的Google AppEngine NDB文档指出: 'All query options keyword arguments are supported.' 但是,我试图在map()上使用produce_cursors = True,而我没有得到光标.map(callback, pass_batch_into_callback=None, m

概述

map()的Google AppEngine NDB文档指出:

“All query options keyword arguments are supported.”

但是,我试图在map()上使用produce_cursors = True,而我没有得到光标.

map(callback,pass_batch_into_callback=None,merge_future=None,**q_options)

我想使用map(),因为我可以将回调设置为tasklet.

https://developers.google.com/appengine/docs/python/ndb/queryclass#kwdargs_options

编辑 – 提供代码示例:

@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)

但是,只有在使用迭代器时才使用游标,而不使用map().查看异步迭代器示例;这是一些工作,但你绝对可以使用它为每个结果手动创建一个tasklet.

总结

以上是编程之家为你收集整理的python – NDB映射(回调,produce_cursors = True)全部内容,希望文章能够帮你解决python – NDB映射(回调,produce_cursors = True)所遇到的程序开发问题。


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶