google app engine - GQLQuery with_cursor not working -


wondering if knows why using cursors gqlquery doesn't seem working properly.

i'm running following.

query = "select * mytable accountid = 'agdwmnbtzxnochaleglttkfjy291bnqypqem' , lastupdated > datetime('0001-01-01 00:00:00') order lastupdated asc limit 100"  if lastcursor:         datalookup = gqlquery(query).with_cursor(lastcursor) else     datalookup = gqlquery(query)  //datalookup.count() here returns value 350  dataitem in datalookup:       ... processing ...  mycursor = datalookup.cursor()  datalookup2 = gqlquery(query).with_cursor(mycursor)  //datalookup2.count() returns 0, though indicates many more batches can returned 

thanks help.

you should not use limit in query, return first 100 results, , assume want of them, process them in batches of 100 each time.

here's (based on example code):

query = gqlquery("select * mytable accountid =    'agdwmnbtzxnochaleglttkfjy291bnqypqem' ,    lastupdated > datetime('0001-01-01 00:00:00') order lastupdated asc")  datalookup = query.fetch(100) # first 100 results  dataitem in datalookup:   # processing  mycursor = query.cursor() # returns last entry of previous fetch  if mycursor:   # next 100 results   datalookup2 = query.with_cursor(mycursor).fetch(100)  

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -