Reputation: 625
I have a workbook containing one data source being an extract file, I'm trying to update this file through hyper API, this is how my code looks like :
with server.auth.sign_in(tableau_auth):
# Get the project ID
all_projects, pagination_item = server.projects.get()
project_id = next(project.id for project in all_projects if project.name == project_name)
# Find the workbook
all_workbooks, pagination_item = server.workbooks.get()
print("Workbooks available:")
for workbook in all_workbooks:
print(f"Workbook name: {workbook.name}, Workbook ID: {workbook.id}")
workbook = next(workbook for workbook in all_workbooks if workbook.name == workbook_name)
# Get the workbook's data sources
server.workbooks.populate_connections(workbook)
data_source = next(ds for ds in workbook.connections if ds.datasource_name == data_source_name)
# Update the data source with the new file
new_data_source = TSC.DatasourceItem(project_id, name=data_source.datasource_name)
new_data_source = server.datasources.publish(new_data_source, local_file_path,
TSC.Server.PublishMode.Overwrite)
# Refresh the workbook to reflect the new data
server.workbooks.refresh(workbook.id)
print(f"Workbook {workbook.name} (ID: {workbook.id}) has been refreshed.")
print("Data source updated and workbook refreshed.")
this code executes correctly but when i go to my tableau server i don't see any changes, i also find the output.hyper file that i'm trying to push in the project folder like so:
after i run the code i also get a notification saying that the workbook is out of date but clicking refresh doesn't do anything either.
Am i doing something wrong here?
Upvotes: 0
Views: 93