You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In tableauserverclient/server/query.py, QuerySet.__iter__ catches a 400006 "invalid page number" error (which signals the end of pagination on some endpoints) and raises StopIteration to break out of the loop:
exceptServerResponseErrorase:
ife.code=="400006":
raiseStopIteration# PEP 479: converted to RuntimeError inside generator
Since Python 3.7 (PEP 479), StopIteration raised inside a generator frame is automatically converted to RuntimeError. Because __iter__ is a generator (it uses yield from), this path raises RuntimeError instead of ending iteration cleanly.
We confirmed this locally — iterating a QuerySet against an endpoint that returns 400006 on page 2 raises:
RuntimeError: generator raised StopIteration
The fix is to return from the generator directly rather than raising StopIteration:
exceptServerResponseErrorase:
ife.code=="400006":
return# cleanly ends the generator
Activity
fix: use return instead of raise StopIteration in QuerySet.__iter__
fix: use return instead of raise StopIteration in QuerySet.__iter__
fix: use return instead of raise StopIteration in QuerySet.__iter__
fix: use return instead of raise StopIteration in QuerySet.__iter__ (t…