有没有一种方法可以为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.