GQL Request BadArgument Error. How to get around with my case?
-
20-09-2019 - |
Question
My query is essentially the following:
entries=Entry.all().order("-votes").order("-date").filter("votes >", VOTE_FILTER).fetch(PAGE_SIZE+1, page* PAGE_SIZE)
I want to grab N of the latest entries that have a voting score above some benchmark (VOTE_FILTER). Google currently says that I cannot filter on 'votes' because I order by 'date.' I don't see a way that I can do this the way I want to, so I'd appreciate any advice.
Solution
Assuming your 'vote filter' is a fixed threshold, you need to add a property to your model that records if it's above that threshold or not, enabling you to do a simple equality test to determine which records should be included.
OTHER TIPS
Yep, there are Restrictions on Queries as this is Gql not Sql. It looks like you'll need to use a Query Cursor and reject entries on votes <= VOTEFILTER
in your code.
The semantics of Bigtable are certainly different than an RDBM and I'm still trying to wrap my head around them, too.