Oh and you can leave out zero. I assume you don't ship zero items, so everything has to be greater than zero.
On Tue, Feb 1, 2011 at 1:32 PM, Stephen Johnson <[email protected]>wrote: > This won't entirely get rid of your need to loop, but you can add an > indexed list property on your entity (let's call it shipped_increments) and > put certain markers in it to indicate that the entity is greater than a > certain amount of items shipped in certain increments (the increments would > depend on your particular case), for example, let's suppose we use an > increment of 100 and let's say we have an entity where the number of items > shipped was 237 then you would have a list like: 0, 100, 200. If the number > of items shipped where 983, then we would have 0, 100, 200, 300, 400, 500, > 600, 700, 800, 900. And if the number of items shipped where 493, we would > have 0, 100, 200, 300, 400. The choice of increment would be important. > Then, let's say we want to know all the item names shipped after a date with > at least 433 items, we would do a query with: > > manufactured_date > date and shipped_increments = 400 > > Then, you would need to loop through the results and remove the ones that > are from 400 to 432 because we want the ones >= 433. > > Your choice of increments would be important so you don't get to big of > indexing, but there's always a choice between indexing space and speed. > > Hope this helps and possibly leads you to a reasonable solution, > Stephen > > > On Tue, Feb 1, 2011 at 11:24 AM, Prashanth <[email protected]>wrote: > >> Thanks Jeff and Wim for the responses. >> >> I missed out giving the number of records in the datastore. >> The datastore has ~1 million records and ever increasing. >> The solution which we have now is, get all the records greater than >> the input date [most restrictive] in a query and then loop thru the >> records for records greater than x_items. >> This solution hit performance badly. Hence looking for an alternative >> solution. >> >> Any suggestions please. >> Thanks for reading this. >> >> On Feb 1, 11:05 pm, Jeff Schwartz <[email protected]> wrote: >> > If you intend to make multiple calls passing the cursor back and forth >> > between client and server then that would work but if you intend to do >> it >> > all in one request then I think the poster of the original question >> would >> > need to define how much data they were talking about which brings me >> back to >> > what I suggested earlier which is: if you are talking about merely >> trivial >> > amounts of data then it would work but if he is talking about anything >> more >> > than merely trivial amounts of data then it wont work and another >> approach >> > would be needed. >> > >> > Jeff >> > >> > I'd prefer a neater package: begin a task that kicks of multiple >> queries to >> > retrieve all the results - the tasks can use a cursor. When the tasks >> have >> > completed their work >> > >> > On Tue, Feb 1, 2011 at 12:28 PM, Wim den Ouden <[email protected]> >> wrote: >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > > no, no, first the query on is item_names and more than x_items, >> > > then a loop on the result from this query (for items in resultquery:) >> > > if some_input_date > date: append to list >> > > when ready show list >> > >> > > you can play with fetch(..) to get optimum speed and cpu usage. >> > > ofcourse not a top solution, but it works till?? >> > > gr >> > > wim >> > >> > > 2011/2/1 Jeff Schwartz <[email protected]>: >> > > > This would require 2 inequality filters so no luck. >> > >> > > > On Tue, Feb 1, 2011 at 7:17 AM, Prashanth <[email protected] >> > >> > > wrote: >> > >> > > >> Hi, >> > >> > > >> Am trying to query my Google App Engine datastore [Python], which >> has >> > > >> a item_name, manufacturing_date and number_of_items_shipped. >> > > >> The scenario: >> > > >> Get all the item_names which has been shipped more than x_items >> [user >> > > >> input] and manufactured after some_input_date [user input]. >> > > >> Basically, kind of inventory check. >> > >> > > >> But due to restrictions on queries in GAE, am not able to do this. >> > >> > >http://code.google.com/appengine/docs/python/datastore/queries.html#R. >> .. >> > >> > > >> I tried searching on the internet for this issue. But, no luck till >> > > >> now. Did you come across this issue, if so, were you able to >> resolve >> > > >> this? Please let me know. >> > >> > > >> Also in Google I/O 2010, "Next Gen Queries" [ >> http://www.youtube.com/ >> > > >> watch?v=ofhEyDBpngM#t=3m17s], Alfred Fuller mentioned that they are >> > > >> going to remove this restriction soon. Its been more than 8 months, >> > > >> but this restriction is in place even now. Makes life very >> difficult. >> > >> > > >> Appreciate if anyone can post an answer if they were able to >> > > >> circumvent this restriciton. >> > > >> Thanks a lot. >> > >> > > >> Regards, >> > > >> Prashanth. >> > >> > > >> -- >> > > >> You received this message because you are subscribed to the Google >> > > Groups >> > > >> "Google App Engine" group. >> > > >> To post to this group, send email to >> [email protected]. >> > > >> To unsubscribe from this group, send email to >> > > >> [email protected]<google-appengine%[email protected]><google-appengine%2Bunsubscrib >> [email protected]> >> > > . >> > > >> For more options, visit this group at >> > > >>http://groups.google.com/group/google-appengine?hl=en. >> > >> > > > -- >> > > > Jeff Schwartz >> > >> > > > -- >> > > > You received this message because you are subscribed to the Google >> Groups >> > > > "Google App Engine" group. >> > > > To post to this group, send email to >> [email protected]. >> > > > To unsubscribe from this group, send email to >> > > > [email protected]<google-appengine%[email protected]><google-appengine%2Bunsubscrib >> [email protected]> >> > > . >> > > > For more options, visit this group at >> > > >http://groups.google.com/group/google-appengine?hl=en. >> > >> > > -- >> > > gr >> > > Wim den Ouden >> > > Custom applications,https://e-comm.appspot.com/ >> > > Free open source E-commerce/E-bookkeeping/E-business framework (web) >> > > apps,http://code.google.com/p/relat/ >> > > Gae developer tips,http://code.google.com/p/relat/wiki/gaetips >> > >> > > -- >> > > You received this message because you are subscribed to the Google >> Groups >> > > "Google App Engine" group. >> > > To post to this group, send email to >> [email protected]. >> > > To unsubscribe from this group, send email to >> > > [email protected]<google-appengine%[email protected]><google-appengine%2Bunsubscrib >> [email protected]> >> > > . >> > > For more options, visit this group at >> > >http://groups.google.com/group/google-appengine?hl=en. >> > >> > -- >> > *Jeff Schwartz* >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<google-appengine%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/google-appengine?hl=en. >> >> > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
