有没有办法为 ndb.get_multi() 指定投影? [英] Is there a way to specify a projection for ndb.get_multi()?

查看:25
本文介绍了有没有办法为 ndb.get_multi() 指定投影?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 NDB,可以指定投影对于查询,允许限制为与查询匹配的实体检索的属性数量.

Using NDB, it is possible to specify a projection for a query, allowing to limit the number of properties that are retrieved for the entities that match the query.

但是,我在文档中找不到任何关于在使用 ndb.get_multi() 时如何指定投影的内容,它总是获取完整的实体.

However, I couldn't find anything in the documentation about how to specify a projection when using ndb.get_multi(), which always fetches complete entities.

有没有办法在使用 ndb.get_multi() 时只获取某些属性?

Is there a way to fetch only certain properties when using ndb.get_multi()?

推荐答案

不,投影功能仅适用于查询.投射 get() 操作没有任何优势(就更少的 I/O 操作而言).

No, the projection feature only works for queries. There would be no advantage (in terms of fewer I/O operations) to projecting get() operations.

这篇关于有没有办法为 ndb.get_multi() 指定投影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆