1
votes

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?

2

2 Answers

4
votes

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.

1
votes

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.