Filter on the server with .filter()

Ask for exactly the content you mean — one owner, one tag, everything stale — instead of downloading the site and looping.

intermediate7 min1 step

Why it matters

On a 10,000-workbook site, "download everything, then if-statement" costs 100 requests before your real logic runs once. filter() pushes the predicate to the server Django-style — field__operator=value — so the response is already the answer. The tradeoff: only the fields Tableau's REST API marks filterable work, and they vary by endpoint. TSC validates the field name locally and raises ValueError before touching the network, so a typo costs you a stack trace, not a wrong answer.

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 three server-side filtered lists: workbooks owned by a name given on the command line (owner_name equality), workbooks carrying any of the tags 'finance' or 'audited' (tags__in), and workbooks not updated since a cutoff date given on the command line (updated_at__lte, RFC 3339 format like 2025-01-01T00:00:00Z). Use .filter() so the server does the work — no client-side loops over the full site — and print which filter produced each section.

The shorthand reads like Django: the keyword is a snake_case field name, a double underscore, and an operator. No suffix means equality. The operators TSC accepts: eq, gt, gte, lt, lte, in, has, and cieq (case-insensitive equality).

Dates are compared as RFC 3339 strings — 2025-01-01T00:00:00Z — which makes updated_at__lte the workhorse of every stale-content audit. Field names are validated against the REST API's filterable set before any request is made; which fields are filterable varies by endpoint, and Tableau's Filtering and Sorting reference is the source of truth.

python
.py
Needs your Tableau site

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