【发布时间】:2022-01-22 07:25:35
【问题描述】:
寻找一种使用 ndb 查询对属性列表求和的有效方法。目前我只是获取结果并在它们上运行一个 for 循环。
class Player(ndb.Model):
score = ndb.IntegerProperty()
score_of_group = 0
all_players = Player.query().filter("various filters").fetch()
for player in all_players:
score_of_group += player.score
【问题讨论】:
标签: python-2.7 google-app-engine google-cloud-datastore