有没有办法为 ndb.get_multi() 指定投影? [英] Is there a way to specify a projection for 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屋!