简体   繁体   中英

How to apply dependent fileds filters in appengine datastore?

Representation of my datastore:

key|first|second|
-----------------
xys|55   |34
-----------------
kow|32   |67

If I have to write a sql query then it should be like this:

select * from x where first > second + 20;

How could I write it in appengine datastore ? Is there any way to achieve it by Query.FilterPredicate ?

Based on the fact that all appengine queries must be efficient. I cant see how to avoid a full scan using datastore indexes of those two properties which is not efficient.
the solution is to also store the difference (first-second) then you can filter on the difference > 20.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM