Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top