Skip to content

continuation_token is not taken into account #13265

Description

@clementta

Hi,

  • Package Name: azure-sdk-for-python comos
  • Package Version: 4.1.0
  • Operating System: MacOS
  • Python Version: 3.7.5

Describe the bug
In a Proxy container, query_items() method returns a ItemPaged object.
This object has a method by_page which can take a continuation_token.

However, after reading the source code. This continuation token seems to never be used anywhere.
The workflow seems to be:

  • next for PageIterator (take the continuation token)
  • self._get_next (propagates the token
  • self._fetch_next (of QueryIterable). Take *args and do not use them

To Reproduce

# cosmosdb_container a ProxyContainer
query = cosmosdb_container.query_items("select * from r", partition_key=NonePartitionKey, max_item_count=1)  # 1 to be sure to have many pages
pager = query.by_page()  # pager starting at first object
first_page = pager.next()
token = pager.continuation_token
real_second_page =  pager.next()
new_pager = query.by_page(token) # pager supposed to start at object number 2
should_be_second_page = new_pager.next()
assert first_object == should_be_second_object  # True but should be False

Expected behavior
real_second_page should be the same as should_be_second_object (from example from above)

Additional context
We were using options["continuation"] in previous version which works just fine with these continuation token so it looks like a regression compared to version 3.x

Have a nice day.

Metadata

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.Cosmoscustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions