简体   繁体   中英

Google App Engine datastore does not support operator +

I'm playing with GAE, and need to make a query with something like this:

select from models.Post as p where (p.votesUp + p.votesDown > 10)

But I get this error: App Engine datastore does not support operator +

Which could be a good approach to replace that query?

The obvious thing that leaps out at me is to put a method on p that has a p.netVotes and query on that.

But I'm not familiar enough with App Engine (I just started looking at it) to be sure that that works.

This sounds similar to the issue with counters in app engine . The simplest solution off the top of my head is to add a votesTotal attribute that is updated every time votesUp and votesDown is updated. Thus there's no large computation when you query for votesTotal > foo_val.

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