Skip to content

Commit

Permalink
fix: change when result cache gets emptied
Browse files Browse the repository at this point in the history
There are many methods on QuerySet that implicitly call
fetch_all. This moves emptying the result cache to immediately
before the explicit call to fetch_call after the page number has
been updated. This ensures that the correct latest page is fetched.
  • Loading branch information
jorwoods committed Jun 19, 2024
1 parent 7b0cd6a commit 2def515
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tableauserverclient/server/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def __iter__(self: Self) -> Iterator[T]:

for page in count(1):
self.request_options.pagenumber = page
self._result_cache = []
self._fetch_all()
yield from self._result_cache
# Set result_cache to empty so the fetch will populate
self._result_cache = []
if (page * self.page_size) >= len(self):
return

Expand Down

0 comments on commit 2def515

Please sign in to comment.