Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In ndb, how to query for items where property A is not in list B?

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))

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

like image 604
Alon Gubkin Avatar asked Dec 12 '22 09:12

Alon Gubkin


1 Answers

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.

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

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.

like image 72
dragonx Avatar answered May 11 '23 16:05

dragonx