[google-appengine] Re: DB lmitations: how to use multiple criteria on many columns? URGENT!
Neither of these will work; you can't use inequality filters on more than one property. Thanks for the heads up on that. I thought I was missing something obvious as the question seemed too straighforward and I've not had to do such queries yet. For those looking for more info on queries and indexes, the relevant documentation is here: http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html#Restrictions_on_Queries -- 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-appeng...@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.
[google-appengine] Re: DB lmitations: how to use multiple criteria on many columns? URGENT!
You will need to do this within your application. So narrow down your initial dataset with a filter on one column, then use application logic to process the results to find records with your required values. Cheers Greg. -- 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-appeng...@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.
[google-appengine] Re: DB lmitations: how to use multiple criteria on many columns? URGENT!
I'm assuming that rooms and floor are integers, that is, you want the entries which have rooms=3 and 4, and floor = 1 and 2. With this assumption you one can construct a query which only have one inequality: SELECT * FROM house WHERE cost 5 AND cost 15 AND rooms IN (3, 4) AND floor IN (1, 2) Worth noting is that this query is actually executed as 4 queries (one for each combination of IN-parameters). Apart from the additional performance, AppEngine limits the number of subqueries like this to 25 (if I remember correctly). So you can't scale this to any number of rooms/floors if you need to. On 19 Sep, 08:11, GAE-framework.googlecode.com anton.danilche...@gmail.com wrote: Hillo GAE developers! I have a serious situation with datastore. I need select data from model with multiple criteria. I have a House model, where exists fields: cost, rooms, floor. I need filter all houses, where cost 5 and 15, and also rooms = 3 and 5, and also floor = 1 and 3. How can I select this dataset? As I see, the Datastore says that I can use filter criteria with , , =, = and != only on one column. But I reallly need use this rules on multiple columns. Please, help me!!! How to implement my task with Datastore limitations? Thank you. I really need your help. -- 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-appeng...@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.
[google-appengine] Re: DB lmitations: how to use multiple criteria on many columns? URGENT!
I believe you can do this in two ways: Either using GQL (see: http://code.google.com/appengine/docs/python/datastore/gqlreference.html) eg: SELECT * FROM House WHERE cost 5000 AND cost 15 AND rooms = 3... etc Or by chaining your filters on your Model class (http:// code.google.com/appengine/docs/python/datastore/ queryclass.html#Query_filter): eg: House.filter('cost ', 5000).filter('cost ', 15).filter('rooms = ', 3)... etc Note you can't use OR in GQL. P.S. Putting URGENT in your message title generally guarantees a slow response on message boards... :-) On Sep 19, 9:11 am, GAE-framework.googlecode.com anton.danilche...@gmail.com wrote: Hillo GAE developers! I have a serious situation with datastore. I need select data from model with multiple criteria. I have a House model, where exists fields: cost, rooms, floor. I need filter all houses, where cost 5 and 15, and also rooms = 3 and 5, and also floor = 1 and 3. How can I select this dataset? As I see, the Datastore says that I can use filter criteria with , , =, = and != only on one column. But I reallly need use this rules on multiple columns. Please, help me!!! How to implement my task with Datastore limitations? Thank you. I really need your help. -- 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-appeng...@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.
[google-appengine] Re: DB lmitations: how to use multiple criteria on many columns? URGENT!
On Sep 20, 4:22 am, adams ad...@contentedweb.com wrote: I believe you can do this in two ways: Either using GQL (see:http://code.google.com/appengine/docs/python/datastore/gqlreference.html) eg: SELECT * FROM House WHERE cost 5000 AND cost 15 AND rooms = 3... etc Or by chaining your filters on your Model class (http:// code.google.com/appengine/docs/python/datastore/ queryclass.html#Query_filter): eg: House.filter('cost ', 5000).filter('cost ', 15).filter('rooms = ', 3)... etc Neither of these will work; you can't use inequality filters on more than one property. -- 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-appeng...@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.
[google-appengine] Re: DB lmitations: how to use multiple criteria on many columns? URGENT!
Hi, I´ve come with a solution to a similar problem I had. What I did was this: Lets say you can have MAX 6 rooms, so, on one field you store the actual number of rooms and in other a list of room queries que entity fits: I'll explain myself: class Entity{ Long rooms; ArrayListLong roomQueries; } Now you need a code for every possible query for a room range i.e. 14 (from 1 to 4), 23 (from 2 to 3), 1 (exactly 1). Then you calculate the ranges that fit your number of rooms and store them in roomQueries. Having all this set, you can query with a equality filter i.e .filter(roomQueries = 56). Another way of implementing this (actually the one im using) is assigning every slot a power of 2, then a range query would be the sum of all slots values involved Using the above case, you'd have 1 room -- 1 2 rooms -- 2 3 rooms -- 4 4 rooms -- 8 5 rooms -- 16 6 rooms -- 32 the the query for 2 to 3 rooms would be = 6, 2 to 5 = 30.. and so on. Hope this can help you :) On Sep 19, 2:11 am, GAE-framework.googlecode.com anton.danilche...@gmail.com wrote: Hillo GAE developers! I have a serious situation with datastore. I need select data from model with multiple criteria. I have a House model, where exists fields: cost, rooms, floor. I need filter all houses, where cost 5 and 15, and also rooms = 3 and 5, and also floor = 1 and 3. How can I select this dataset? As I see, the Datastore says that I can use filter criteria with , , =, = and != only on one column. But I reallly need use this rules on multiple columns. Please, help me!!! How to implement my task with Datastore limitations? Thank you. I really need your help. -- 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-appeng...@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.