Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

cursor_after() doesn't exist at end of iteration #292

@oliverchang

Description

@oliverchang

There is a behaviour difference with the old NDB that we're relying on wrt to cursor_after() at the end of iterating through a query.

Given the following:

      class Model(ndb.Model):                 
        a = ndb.IntegerProperty()                 
                                      
      Model(a=1).put()   
      Model(a=2).put()
      Model(a=3).put()   
                 
      result = Model.query().iter(limit=2)
      print(list(result))                                                                               
      print(list(Model.query().iter(start_cursor=result.cursor_after())))

The old NDB gives:

[Model(key=Key('Model', 31), a=1), Model(key=Key('Model', 32), a=2)]
[Model(key=Key('Model', 33), a=3)]

The new NDB gives:

[Model(key=Key(u'Model', 31L), a=1L), Model(key=Key(u'Model', 32L), a=2L)]
BadArgumentError: There is no cursor currently

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions