【发布时间】:2017-02-14 20:49:42
【问题描述】:
下面的这组查询将一堆配置文件连接在一起以返回到网站。
我想对这些进行一次查询,因为我想对整个配置文件集合使用 order 函数。
# Get all users for who 'currentUser' is an assistant for.
users = Users.query(Users.assistant.IN(currentUser)).fetch()
# Get all profiles that belong to those users and have not been deleted.
for user in users:
profiles = profiles + Profiles.query(
ndb.AND(
Profiles.user == user.username,
Profiles.deleted == False
)
).order(Profiles.history).fetch() # Order all profiles by timestamp
【问题讨论】:
标签: python google-cloud-datastore app-engine-ndb datastore