google app engine - GAE ndb.query.filter() not working -


i have story model inherits ndb.model, integerproperty wordcount. i'm trying query story objects have specific word count range, query seems return same results, regardless of filter properties.

for code:

q = story.query() q.filter(story.wordcount > 900) s in q.fetch(5):     print s.title / s.wordcount 

i result:

if ... / 884
timed release / 953
grandfather paradox / 822
harnessing brane-deer / 1618
quantum erat demonstrandum / 908

here's story declaration:

class story(ndb.model):     title = ndb.stringproperty(required=true)     wordcount = ndb.integerproperty('wc') 

i expect stories have 900 words exactly--or none. inequalities , sorting broken. tried deploying gae, , i'm seeing same broken results.

any ideas on causing this?

ndb queries immutable, , when call q.filter(story.wordcount > 900) you're creating new query, , not assigning anything. re-assigning q variable should work you:

q = story.query() q = q.filter(story.wordcount > 900) s in q.fetch(5):     print s.title / s.wordcount 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -