Walk everything with Pager and .all()

Iterate every workbook, user, or data source on a site without ever thinking about page numbers.

beginner6 min1 step

Why it matters

Pagination is bookkeeping, and bookkeeping is what libraries are for. TSC.Pager wraps any get()-style endpoint and fetches the next page lazily as your loop crosses a page edge; .all() gives you the same walk as a chainable QuerySet. The tradeoff to respect: a full walk is one HTTP request per page, so iterating a 5,000-workbook site is 50 requests — fine in an audit script, worth a pause before you nest it inside another loop.

Prompt Recipe

Write a Python script using tableauserverclient that signs in with a Personal Access Token from environment variables (TABLEAU_SERVER_URL, TABLEAU_TOKEN_NAME, TABLEAU_TOKEN_VALUE, TABLEAU_SITE_ID) and prints the name and last-updated date of every workbook on the site — all of them, not the first page — using TSC.Pager. Then print the total count and assert it equals what a plain get() reports in pagination_item.total_available, so the script proves its own completeness.

TSC.Pager is the classic form: wrap the endpoint, iterate, and page two is fetched the moment your loop steps past item one hundred. .all() is the modern form — it returns a lazy QuerySet that walks identically but also chains into the filtering and sorting you will meet two stops up.

Both are lazy. Neither loads the site into memory up front, and if you break out of the loop early, the remaining pages are never requested.

python
.py
Needs your Tableau site

Got what you came for? Mark the stop and the line fills in beneath you.