Skip to content

Commit

Permalink
fix: null out PaginationItem._page_number
Browse files Browse the repository at this point in the history
Tests were failing because the fetch_all method added a second
check before fetching the next page. This fix will allow the
next page to be retrieved when used normally
  • Loading branch information
jorwoods committed Oct 15, 2024
1 parent b0da014 commit 844b171
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tableauserverclient/server/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def __iter__(self: Self) -> Iterator[T]:
for page in count(1):
self.request_options.pagenumber = page
self._result_cache = []
self._pagination_item._page_number = None
try:
self._fetch_all()
except ServerResponseError as e:
Expand Down Expand Up @@ -141,6 +142,7 @@ def __getitem__(self, k):
elif k in range(self.total_available):
# Otherwise, check if k is even sensible to return
self._result_cache = []
self._pagination_item._page_number = None
# Add one to k, otherwise it gets stuck at page boundaries, e.g. 100
self.request_options.pagenumber = max(1, math.ceil((k + 1) / size))
return self[k]
Expand Down

0 comments on commit 844b171

Please sign in to comment.