Friday, May 1, 2009

Building an App Engine Google Query - Terror of the missing white space

Lesson learned:

Always use white space between query filters and the equality signs otherwise the equal sign will be interpreted as part of the index key.

Example:

Wrong:


cattoplist = dbmodels.DailyStats.all().filter("kc_date=", today).filter("kc_category=", cat.cat_id).order("-visitor_new").fetch(catnum, catoffset)

Good:


cattoplist = dbmodels.DailyStats.all().filter("kc_date =", today).filter("kc_category =", cat.cat_id).order("-visitor_new").fetch(catnum, catoffset)



No comments:

Post a Comment