python - Google App Engine NDB - Cursor on query working on local dev but not in production -
i have issue. call query cursor set cursor() first time around. fetch 50 items query
qry = cls.query(cls.store == store_id, cls.user != exclude_user, cls.active == true, cls.offline == false).order(cls.user, cls._key, -cls.created) i return qry calling class , run following fetch
result, next_cursor, more = qry.fetch_page(pagination, start_cursor=cursor) this works no problem, following cursor , pass client per docs:
client_params['next_page'] = next_cursor.urlsafe() i have logged cursor make sure same on return call server, is
i thus:
cursor = cursor(urlsafe=page) however second attempt retrieve next 50 or less items results in following error:
badrequesterror: cursor position outside range of original query now whole process works fine on local development machine not in production
i suspect trouble comes cls.user != exclude_user query parameter.
from limitations of cursors (yes, known it's in superseded db documentation, i'm pretty sure applies ndb - same limitations are present in java well, they're on datastore side, not on client library side):
- because
!=,inoperators implemented multiple queries, queries use them not support cursors.
to confirm try drop query parameter.
as why happens in production - development server emulation doesn't cover details.
Comments
Post a Comment