On 6 Apr, 20:47, Benjamin Ortuzar <[email protected]> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to