10 days history from now should be
startdatetime = datetime.now() - timedelta (days = 10)
or gql with integer form and datetime
where pubdate < DATETIME(2009,3,2) and pubdate > DATETIME(2009,3,1)
order by pubdate desc
2 more date range query discussions + the python datetime manual have
more examples
http://groups.google.com/group/google-appengine/browse_thread/thread/45d460da135597dc/f386d5f7cbcacbf0?hl=en&q=#f386d5f7cbcacbf0
http://code.google.com/appengine/articles/paging.html
Datastore errors in dataview can occur if entities are removed and
references didn't update.
best regards
Niklas
On Apr 8, 6:00 am, Benjamin Ortuzar <bortu...@gmail.com> wrote:
> Hi Niclas,
>
> I tried your remomendations.
>
>   data = myData.all().filter("mytype=", type)
> is returning all the correct that. as soon as i add:
>
>  .filter("pubdate >", startDate)
>
> it starts going wrong.
>
> I also changed:
>
>   endDate = datetime.datetime.today()  //so it is a datetime instead
> of date
>
> It seems that the date filter is not working very well.
>
> I checked all the data in dataviewer, and its fine. For some reason i
> get errors randomly when queriing in dataviewer,even if the syntaxis
> is correct.
>
> When I execute this query:
> SELECT * FROM myData WHERE type = '1' ORDER BY pubdate DESC
>
> I dont see the date after going trough all the pages in dataViewer.
>
> But if I search for this:
>
> SELECT * FROM myData WHERE type = '1'
>
> I see the result for the missing date in the first page of dataViewer.
>
> I went inside the entity that was missing, clicked on Save Entity, and
> now its appearing under my filtered searches.
>
> What do you suggest? My data was uploaded using the google bulkload
> python script, and it run successfully with no errors.
>
> Thanks,
> ben
>
> On Apr 7, 4:18 pm, niklas <nikla...@gmail.com> wrote:
>
> > On 6 Apr, 20:47, Benjamin Ortuzar <bortu...@gmail.com> wrote:
>
> > > Hi gents,
>
> > > Im trying to search for some codes within a date range, but some dates
> > > that exist in the database are not being returned by the query. Here
> > > is an extract of the code in using.
>
> > >             deltaDays = timedelta(days= 10)
> > >             endDate = datetime.date.today()
> > >             startDate = endDate - deltaDays
>
> > >             result = db.GqlQuery(
> > >                 "SELECT * FROM myData WHERE mytype = :1 AND pubdate>= :2 
> > > and pubdate <= :3", type, startDate, endDate
>
> > >                     )
>
> > > class myData(db.Model):
> > >     mytype = db.StringProperty(required=True)
> > >     value =  db.FloatProperty(required=True)
> > >     pubdate = db.DateTimeProperty(required=True)
>
> > > The script returns :
>
> > >  2009-03-18 00:00:00
> > > (missing date in results: 2009-03-20 data exists in database)
> > >  2009-03-23 00:00:00
> > >  2009-03-24 00:00:00
> > >  2009-03-25 00:00:00
> > >  2009-03-26 00:00:00
> > > (missing date in results: 2009-03-27 data exists in database)
> > >  2009-03-30 00:00:00
> > > (missing date in results: 2009-03-31. data exists in database)
> > >  2009-04-01 00:00:00
> > >  2009-04-02 00:00:00
> > >  2009-04-03 00:00:00
> > >  2009-04-06 00:00:00
>
> > > Any help is appreciated. thanks.
>
> > Hi Benjamin
> > Try fetch the range in other ways with filter or DATETIME wrapper
> > data = myData.all().filter("mytype=", type).filter("pubdate >",
> > startDate)
> > or
> > result = db.GqlQuery("SELECT * FROM myData WHERE mytype = :1 AND
> > pubdate >= DATETIME(2009,03,18)", type)
> > or use dataviewer directly to see differences between rows.
> > Regards
> > Niklas
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to