Tableau Server Client (TSC)
raw JSON → 0.40 verified Tue May 12 auth: no python install: verified
Tableau Server Client (TSC) is a Python library that enables programmatic interaction with the Tableau Server REST API. It allows users to manage and modify various Tableau Server and Tableau Cloud resources, such as publishing workbooks and data sources, creating users and groups, and querying projects and sites. The library is actively maintained, with the latest version being 0.40 and frequent releases including new features and bug fixes.
pip install tableauserverclient Common errors
error ModuleNotFoundError: No module named 'tableauserverclient' ↓
cause The tableauserverclient library is not installed in the active Python environment.
fix
pip install tableauserverclient
error tableauserverclient.server.endpoint.exceptions.ServerResponseError: 401001: Unauthorized access. ↓
cause Authentication failed due to incorrect credentials (username, password, or Personal Access Token), an invalid site name, or attempting an operation before successfully signing in.
fix
Verify your TableauAuth credentials and site ID, and ensure that server.auth.sign_in() is called correctly before other operations.
tableau_auth = TSC.TableauAuth('username', 'password_or_pat', site_id='your-site-id')
server = TSC.Server('https://your-tableau-server.com', use_server_version=True)
with server.auth.sign_in(tableau_auth):
# Your operations here
error tableauserverclient.server.endpoint.exceptions.ServerResponseError: 409003: A resource with the specified name already exists. ↓
cause Attempting to publish a workbook or data source with a name that already exists on Tableau Server without specifying the overwrite option.
fix
Set
mode='Overwrite' in the server.workbooks.publish() or server.datasources.publish() method to replace the existing resource.
new_workbook = TSC.WorkbookItem(name='MyWorkbook', project_id='<project-id>')
server.workbooks.publish(new_workbook, r'C:\Path\To\MyWorkbook.twbx', mode='Overwrite') error tableauserverclient.server.endpoint.exceptions.ServerResponseError: 404003: Resource Not Found ↓
cause The requested resource (e.g., workbook, data source, project, user) could not be found on the Tableau Server, possibly due to an incorrect ID or name.
fix
Double-check the ID or name of the resource you are trying to access or modify to ensure it exists on the server and is spelled correctly.
Warnings
breaking The TSC library version must be compatible with the Tableau Server REST API version it is connecting to. Incompatible versions can lead to unexpected behavior or `ServerError` exceptions. ↓
fix Initialize the `TSC.Server` object with `use_server_version=True` (e.g., `server = TSC.Server(URL, use_server_version=True)`) to automatically use the latest REST API version supported by the server. Alternatively, manually set `server.version = 'X.Y'` to target a specific REST API version.
breaking Minor version upgrades of `tableauserverclient` can sometimes introduce subtle breaking changes or stricter validation, particularly around authentication. Users reported `NotSignedInError` issues when upgrading from v0.28 to v0.29. ↓
fix Always review the `tableauserverclient` changelog and release notes before upgrading. If encountering unexpected authentication errors after an upgrade, consider pinning the `tableauserverclient` version in your `requirements.txt` to the last known working version and thoroughly test the new version in a development environment. Review your authentication parameters carefully.
gotcha It is generally not possible to change the authentication *method* (e.g., from username/password to SAML IDP or OAuth) for existing data source connections via `tableauserverclient` or the underlying Tableau REST API. ↓
fix If an authentication method change is required, you may need to download the workbook/data source, modify its XML (e.g., using the Tableau Document API if applicable), and then republish it. Direct in-place updates of authentication methods are not supported.
breaking When running `tableauserverclient` on Python versions older than 3.10, a `TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'` may occur during module import. This is due to the library using the PEP 604 union type syntax (`X | Y`) which was introduced in Python 3.10. ↓
fix Upgrade your Python environment to version 3.10 or newer. Alternatively, if you must use an older Python version (e.g., 3.9), downgrade `tableauserverclient` to a version that does not use the `|` union type syntax (e.g., `tableauserverclient < 0.18`).
breaking The script failed to establish a connection to the Tableau Server host due to a name resolution error (`socket.gaierror: [Errno -2] Name does not resolve`), indicating that the provided server hostname could not be translated into an IP address. This typically means the hostname is incorrect, the server is offline, or there's a DNS configuration issue in the execution environment. ↓
fix Ensure the `URL` provided to `TSC.Server()` (e.g., `https://your-tableau-server.com`) is the correct and fully qualified domain name (FQDN) or IP address of your Tableau Server. Verify network connectivity from the execution environment to the Tableau Server, check DNS settings, and confirm the server is running and accessible.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) wheel - 0.76s 24.5M
3.10 alpine (musl) - - 0.80s 24.3M
3.10 slim (glibc) wheel 2.5s 0.55s 25M
3.10 slim (glibc) - - 0.61s 25M
3.11 alpine (musl) wheel - 1.01s 27.2M
3.11 alpine (musl) - - 1.10s 26.9M
3.11 slim (glibc) wheel 2.6s 0.87s 28M
3.11 slim (glibc) - - 0.83s 27M
3.12 alpine (musl) wheel - 0.85s 18.9M
3.12 alpine (musl) - - 0.92s 18.6M
3.12 slim (glibc) wheel 2.2s 0.90s 19M
3.12 slim (glibc) - - 0.94s 19M
3.13 alpine (musl) wheel - 0.85s 18.6M
3.13 alpine (musl) - - 0.87s 18.3M
3.13 slim (glibc) wheel 2.3s 0.91s 19M
3.13 slim (glibc) - - 1.09s 19M
3.9 alpine (musl) wheel - - 23.8M
3.9 alpine (musl) - - - -
3.9 slim (glibc) wheel 2.9s - 24M
3.9 slim (glibc) - - - -
Imports
- TSC
import tableauserverclient as TSC - Server wrong
from tableauserverclient.server import Servercorrectfrom tableauserverclient import Server - TableauAuth
from tableauserverclient import TableauAuth - PersonalAccessTokenAuth
from tableauserverclient import PersonalAccessTokenAuth
Quickstart last tested: 2026-04-24
import tableauserverclient as TSC
import os
TABLEAU_SERVER_URL = os.environ.get('TABLEAU_SERVER_URL', 'https://your-tableau-server.com')
TABLEAU_SITE_ID = os.environ.get('TABLEAU_SITE_ID', '') # Use '' for Default site
TABLEAU_PAT_NAME = os.environ.get('TABLEAU_PAT_NAME', 'your_pat_name')
TABLEAU_PAT_SECRET = os.environ.get('TABLEAU_PAT_SECRET', 'your_pat_secret')
# 1. Authenticate using Personal Access Token (PAT)
tableau_auth = TSC.PersonalAccessTokenAuth(
token_name=TABLEAU_PAT_NAME,
personal_access_token=TABLEAU_PAT_SECRET,
site_id=TABLEAU_SITE_ID
)
# 2. Initialize the Server object and set API version handling
# It's recommended to use the server's version for compatibility.
server = TSC.Server(TABLEAU_SERVER_URL, use_server_version=True)
try:
# 3. Sign in to Tableau Server
with server.auth.sign_in(tableau_auth):
print(f"Successfully signed in to Tableau Server: {TABLEAU_SERVER_URL}, Site: {TABLEAU_SITE_ID if TABLEAU_SITE_ID else 'Default'}")
# 4. Example: Query all workbooks on the site
all_workbooks, pagination_item = server.workbooks.get()
print(f"\nFound {pagination_item.total_available} workbooks:")
for workbook in all_workbooks:
print(f" - {workbook.name} (ID: {workbook.id})")
except TSC.ServerError as e:
print(f"Tableau Server Error: {e.code}: {e.message}")
except Exception as e:
print(f"An unexpected error occurred: {e}")