Eli, I'm not sure I follow you but as far as I understand that would not be possible in this scenario. Let's say we have a table of articles and we need to know how many articles were created between 15 Dec 2009 and 30 Dec 2009 (or any other dates for that matter) - I would never be able to pre-compute the INPUTDT_BTWN_STRT_END for each article.
In my case, I'm ok with just querying by month so i'll create the year_month field and compute at write time. It seems the better option. Thanks guys :) On Dec 4, 5:45 pm, Eli Jones <[email protected]> wrote: > If you are trying to run a query giving you results where the Input_Date is > between Start_Date and End_Date, then it would be optimal to have a column > that is computed when you insert your row. > > Not sure what to call the column.. but I'll just use "INPUTDT_BTWN_STRT_END" > .. heh > > So, when you insert a new row, entity into your Model, presuming you know at > least your start_date and input_date (or if you only know input_date then > you know it is before start_date, and if you know start_date but not > end_date then you know end_date is after the current date)... > > Then you insert your entity with the INPUTDT_BTWN_STRT_END = 1 if the > input_date is between the start and end dates.. presuming you can tell. Or, > you can have a process that periodically runs to compute this field. > > So, the default value would be INPUTDT_BTWN_STRT_END = -1 ... and > you'd occasionally update all entities with INPUTDT_BTWN_STRT_END = -1 to > 0, 1, 2 where 0 means Input_date is before start_date, 1 = between and 2 = > after End_Date. > > Then you have an easy query that uses a default index and an int property. > > > > On Fri, Dec 4, 2009 at 10:52 AM, sofia <[email protected]> wrote: > > I would like to do something like > > > SELECT * FROM MyTable WHERE input_date >= start_date AND input_date <= > > end_date > > > but I get Inequality Filters Are Allowed On One Property Only > > > See > >http://appengine-cookbook.appspot.com/recipe/how-to-query-by-date-range/ > > > Well, guess i'll have to do the script then > > > On Dec 4, 3:43 pm, Eli Jones <[email protected]> wrote: > > > What do you mean by double filter? > > > > What exactly is the select/query you want to run? > > > > What does your Model look like? > > > > From your description of the issue, it's hard to tell what you mean by > > > "double filter". > > > > Thanks for clarification. > > > > On Fri, Dec 4, 2009 at 9:40 AM, sofia <[email protected]> wrote: > > > > Hi, > > > > > I have a model that I need to filter by date, start and end date. It > > > > has a DateTime property to which this double filter was going to be > > > > applied but I've since found out that this isn't possible in app > > > > engine. So now I want to add a new field with only the year and month, > > > > something like 200912 and will only filter by month. > > > > > So if i have a 1000 rows, like this > > > > > title | date_created | year_month > > > > a string | 2009-10-12 00:00:00 | > > > > the string | 2009-09-22 00:00:00 | > > > > > how do i update in one go all rows so that i end up with this: > > > > > title | date_created | year_month > > > > a string | 2009-10-12 00:00:00 | 200910 > > > > the string | 2009-09-22 00:00:00 | 200909 > > > > > Is there any way to do this, or do I have to create a script that > > > > fetches each row one by one and updates the field accordingly? > > > > > Thanks, > > > > > Sofia > > > > > -- > > > > > 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%2Bunsubscrib > > > > [email protected]><google-appengine%2Bunsubscrib > > [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]<google-appengine%2Bunsubscrib > > [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.
