title: Query cursor for app engine in python using query iterator
body: <p>I want to use pagination not by calling, </p>
  
  <pre><code>greets, next_curs, more = Greeting.query().fetch_page(10, start_cursor=curs)
  </code></pre>
  
  <p>but by using query iterators. Because that way I can use tasklets to club together all consecutive 'gets' as described at, <a href="https://developers.google.com/appengine/docs/python/ndb/async#tasklets" rel="nofollow">https://developers.google.com/appengine/docs/python/ndb/async#tasklets</a></p>
  
  <p>Now in my code things looks like, </p>
  
  <pre><code>class Book(ndb.Model):
      author = ndb.KeyProperty('a', kind=User, required=True)
  
  author_key = ndb.Key(urlsafe=user_id)
  books_query=Book.query(Book.author == author_key)
  @ndb.tasklet
  def callback(book):
       author = yield book.author.get_async()
       raise ndb.Return(book, author)
  
  q_option = {'limit' : 2, 'produce_cursors' : True }
  outputs = books_query.map(callback, **q_option)
  </code></pre>
  
  <p>Not sure where things are going wrong but if I try to do, </p>
  
  <pre><code>books_query.iter().cursor_before() 
  </code></pre>
  
  <p>or </p>
  
  <pre><code>books_query.iter().cursor_after()
  </code></pre>
  
  <p>It fails with following trace,</p>
  
  <pre><code>raise datastore_errors.BadArgumentError('There is no cursor currently')
  BadArgumentError: There is no cursor currently
  </code></pre>
  
  <p>Any elaborate example of using query iterators and tasklets with cursors would be really helpful to wrap my head around this.</p>