对另一个属性具有排序顺序的IN查询的预期结果是什么?

2024-05-03 08:21:10 发布

您现在位置:Python中文网/ 问答频道 /正文

根据文件。。。你知道吗

The IN operator also performs multiple queries, one for each item in the specified list, with all other filters the same and the IN filter replaced with an equality (==) filter. The results are merged, in the order of the items in the list.

如果对另一个属性有排序顺序,会发生什么情况?你知道吗

query = Post.query(Post.tags.IN(['python', 'ruby', 'php'])).order(-Post.views)
results = query.fetch(20)

结果会按视图数降序排列吗?你知道吗

谢谢!你知道吗


Tags: 文件theinwithorderfilterquerypost
1条回答
网友
1楼 · 发布于 2024-05-03 08:21:10

是的,结果将按您指定的顺序排序。如果SDK不提供您请求的结果,它就不允许您执行查询。你知道吗

相关问题 更多 >