RequestOptions: the knob behind every request

Control page size and page number directly — and recognize the object that filtering and sorting are built on.

intermediate6 min1 step

Why it matters

RequestOptions is the mechanism under everything in this route: filters, sorts, and field selection all ride on it. You will mostly let filter() and order_by() build it for you, but two knobs are worth turning by hand — pagesize, because 100-item pages make a 5,000-item walk take 50 round-trips when 5 would do, and pagenumber, because sometimes you genuinely want page 2 and nothing else. The server caps page size at 1,000; asking for more gets you 1,000, not an error.

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 fetches all workbooks two ways, timing each: first walking TSC.Pager with the default page size, then walking TSC.Pager with TSC.RequestOptions(pagesize=1000). Print the item count and elapsed seconds for each so the round-trip cost of small pages is visible.

Build a TSC.RequestOptions, hand it to get() — or to TSC.Pager, which honors it on every page it fetches. On a QuerySet, the same knobs are spelled .paginate(page_size=…, page_number=…).

Bigger pages mean fewer round-trips, and 1,000 is the ceiling the server enforces on its side. Page number is the rarer knob — useful when you are resuming a long walk or sampling, not something to loop over by hand when Pager exists.

python
.py
Needs your Tableau site

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