Description
Describe of bug
When publishing workbooks using TSC's workbooks.publish() method, the operation consistently fails (until a few days ago it was working fine) with a "Datasource 'X' not found" error even when:
-
The referenced datasource verifiably exists on the destination server
-
The datasource is in the same project as the target workbook
-
Authentication is successful and permissions are correct
-
The workbook XML has been comprehensively cleaned of source server references
This appears to be a server-side validation issue within Tableau's publishing pipeline that cannot be resolved through standard TSC parameters or XML manipulation.
Versions
-
Tableau Server version: Tableau Cloud (Online)
-
Python version: 3.10
-
TSC library version: Latest (installed via pip)
To Reproduce
import tableauserverclient as TSC
# 1. Authenticate and connect to destination server
tableau_auth = TSC.PersonalAccessTokenAuth(token_name, token_value, site_id)
server = TSC.Server(server_url, use_server_version=True)
with server.auth.sign_in(tableau_auth):
# 2. Verify datasource exists on destination
all_datasources = list(TSC.Pager(server.datasources))
target_datasource = next((ds for ds in all_datasources if ds.name == 'target_datasource_name'), None)
print(f"Datasource exists: {target_datasource is not None}") # Returns True
# 3. Prepare workbook for publishing
workbook_item = TSC.WorkbookItem(name="Test Workbook", project_id=project_id)
# 4. Attempt to publish workbook that references the verified datasource
published_workbook = server.workbooks.publish(
workbook_item,
'/path/to/workbook.twbx',
mode=TSC.Server.PublishMode.Overwrite,
skip_connection_check=True
)
Current Results
tableauserverclient.server.endpoint.exceptions.ServerResponseError:
400011: Bad Request There was a problem publishing the file 'workbook.twbx'.. (0x9F4C1551 : com.tableausoftware.domain.exception.PublishingException: Datasource 'target_datasource_name' not found for workbook 'Test Workbook'.)
Expected Results
The workbook should publish successfully when the referenced datasource exists on the destination server in the same project, especially when skip_connection_check=True is specified.
Things I've already tried
-
Verified datasource exists via server.datasources.get_by_id() and query operations
-
Confirmed both workbook and datasource are in the same project
-
Removed all XML references to source server (derived-from attributes, server URLs, extract elements)
-
Attempted multiple datasource naming strategies
-
Verified authentication and permissions are correct
-
Tested with skip_connection_check=True parameter
Additional Info
I'm able to successfully publish workbooks that only have an embedded extract. Also, data sources are successfully being published to destination as well.