在ndb中,如何查询属性A不在列表B中的项目? [英] In ndb, how to query for items where property A is not in list B?

查看:111
本文介绍了在ndb中,如何查询属性A不在列表B中的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ndb中,为了查询属性列表 B 中属性 A 的项目,您可以执行一些操作例如:

In ndb, in order to query for items where property A is in list B, you can do something like:

Item.query(Item.A.IN(B))

如何在列表B中查询属性A 不是的项目?

How can you query for items where property A is not in list B?

推荐答案

这是不可能的。请注意,您的IN查询实际上会自动分解为许多不同的EQUALS查询,列表B中的每个项目都将返回合并结果。

It's not possible. Note that your IN query is actually automatically broken down into a number of different EQUALS queries, for each item in list B, and the merged results are returned.

您可以查询然后手动过滤掉,并忽略列表B中的结果。

You could query for all, and then manually filter out and ignore results that are in list B.

典型的GAE解决方案是非规范化和预先计算另一个易于索引的值并查询,并将其保存为Item中的一个属性。

A typical GAE solution would be to denormalize and precompute another value that would be easy to index and query, and save that as a property in Item.

这篇关于在ndb中,如何查询属性A不在列表B中的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆