I think I found it - didn't expect to get lucky so quickly... class DummyData(db.Model): x = db.StringListProperty() y = db.StringProperty()
class Dummy(webapp.RequestHandler): def get(self): d = DummyData() d.x = ['a','b','c'] d.y = 'test' d.put() d = DummyData() d.x = ['c','d','e'] d.y = 'test' d.put() d.x = ['r','s','t'] d.y = 'test2' d.put() q = db.GqlQuery("SELECT * FROM DummyData where x in ('c') and x in ('r') ") results = q.fetch(10) self.response.headers['Content-Type'] = 'text/plain' for r in results: self.response.out.write ("x = " + ",".join(r.x) + " y = " + r.y + "\n") Now when you run the above code you should 'not' get any results. However, the query returns the 3rd record. If you switch the order of the conditions, you get the first two records. My guess is since multiple IN operators will create a combinatorial problem, Gql keeps only the last IN operator. I did not see such a thing being documented, did you see anything to that effect? For my app I would like to use multiple IN operators and can still be within the 30 query limit. I am trying to filter the results by categories and also provide pagination. If I decide to filter everything on the client side, I will have to send all the data to the client which will be inefficient. When I tried to split the query into multiple chunks, it becomes really hard to keep track of previous state. Maybe I should post it a separate question. Please do let me know if you see the same issue. If I have made another mistake then I am probably going crazy and stop worrying about this issue :) Thanks! On Apr 20, 7:21 am, Andy Freeman <ana...@earthlink.net> wrote: > db.TextProperty is not an indexable property. That means that it's > not queryable either. > > It would be nice if to get an exception or some other indication of > what's going on. > > However, note that "indexable" is something that happens in the > datastore when an instance is store. If you change a property from > StringProperty to TextProperty or the reverse, strange things will > probably happen. (If you put some instances with StringProperty, I > suspect that you can still successfully query for those instances > using that property after you've switched to TextProperty.) > > On Apr 19, 1:24 am, ecognium <ecogn...@gmail.com> wrote: > > > Hello everyone, I noticed an odd behavior with GQL query when it has > > two IN operators and a regular condition. Below is some basic code to > > reproduce the problem: > > > class DummyData(db.Model): > > x = db.StringListProperty() > > y = db.TextProperty() > > > class Dummy(webapp.RequestHandler): > > def get(self): > > d = DummyData() > > d.x = ['a', 'b','c'] > > d.y = "test" > > d.put() > > d = DummyData() > > d.x = ['c', 'd','e'] > > d.y = "test2" > > d.put() > > > q = db.GqlQuery("SELECT * FROM DummyData where x in ('c') and > > x in ('a') ") > > results = q.fetch(10) # 10 instead of 2? - useful if you run > > the test multiple times > > for r in results: > > self.response.headers['Content-Type'] = "text/plain" > > self.response.out.write("x = " + ",".join(r.x) + " y = " + > > r.y + "\n") > > > When you run the above code you will see the following output: > > x = a,b,c y = test > > > However when I replace the above query with the one below, I do not > > get any results (even though it should return the same result as > > above): > > > # Note the addition of y = 'test' > > q = db.GqlQuery("SELECT * FROM DummyData where y = 'test' and x in > > ('c') and x in ('a') ") > > > Although here the IN conditions are the same as '=', my application > > actually uses multiple list values.; I am just presenting a simpler > > example. > > > If someone can confirm the issue, I can open a bug report for this. > > > Thanks! > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---