Closed Olivier75999 closed 3 years ago
Perhaps it was accidentally deleted when you removed your variables, but I can't see how you are using the connection information here. Could you add the code that handles it?
Thanks, you helped me understand my mistake. I put this line of code for making the workbook publication and now it works fine: workbook = server.workbooks.publish(workbook, dashboards_nom_fichier.get(mon_dashboard_nom), 'CreateNew', hidden_views=dashboards_sheets_to_hide.get(mon_dashboard_nom), connection_credentials=my_connection_credentials)
Dear Team,
CONTEXT: I'm using Tableau software (Tableau Server and Tableau Desktop). I have several workbooks to publish on Tableau Server. Each workbook has to be published for each customer: the only thing which changes is the connection to the data source. The data sources are always a MS SQL database. There is one MS SQL database per customer.
CHALLENGE: Publishing each workbook for each customer by using Tableau Desktop takes a lot of effort and time. Consequently, I used Tableau Server Client (TSC) library (available at: https://tableau.github.io/server-client-python/docs/) in order to automate in mass the workbook publication onto Tableau Server. For your information, I'm using TBWX files (having size less than 64 MB) with extract and embedded credentials.
EXPECTED RESULT: I'm expecting the workbook publication onto Tableau Server to be equipped with the credentials. So that, the published workbook can be refreshed or a refresh schedule can be setup by using an extra scripting from TSC library.
ACTUAL RESULT: The workbook publication mecanism works fine, except one issue. Once the workbook is published, when I go in 'Data Source' and when I want to modify the connection I obtain the Data Source setup with 'Ask the password to the user'. In this configuration, when I tried to refresh the workbook, I get a job failure: the data in the workbook are not refreshed.
WORKAROUND: The workaround consists in modifying manually the data source by clicking on 'Password integrated to the connection' and by putting the password. Then only, after applying it, the refresh extract works fine.
IMPACT: For each published workbook, I need to manually modify the data source of each published workbook. This is a huge lost of time.
QUESTION: The password of the data source is embedded in the TBWX workbooks. The password of the data source is mentioned in the call of the function TSC.ConnectionCredentials. Why is the password not spread in the published workbook ? How to solve the issue ?
MY CODE (ROOT PART):
REMARK: I DIDN'T DISPLAY THE CONTENT OF MY VARIABLE FOR SECURITY REASON
IMPORT TSC LIBRARY
import tableauserverclient as TSC
Authentification
tableau_auth = TSC.TableauAuth(username, password, site_name) server = TSC.Server(my_server_address, use_server_version=True)
server = TSC.Server(my_server_address) server.version = '3.9'
Sign In
server.auth.sign_in(tableau_auth)
Create a connection and add the above credentials to it
my_connection_credentials = TSC.ConnectionCredentials(name=my_connection_username, password=my_connection_password, embed=True, oauth=False)
connection = TSC.ConnectionItem() connection.server_address = my_server_address connection.server_port = '443' connection.connection_credentials = my_connection_credentials
Workbook creation
workbook = TSC.WorkbookItem(name=dashboards_nom.get(mon_dashboard_nom), project_id=mon_destination_project_id, show_tabs=True) #The project_id has been obtained previously
Workbook publication (in mode CreateNew)
workbook = server.workbooks.publish(workbook, dashboards_nom_fichier.get(mon_dashboard_nom), 'CreateNew', hidden_views=dashboards_sheets_to_hide.get(mon_dashboard_nom))
Sign Off
server.auth.sign_out()
MY CONFIGURATION: Tableau Server version 2020.3.3 Python version 3.9 (64 bit) The REST API version used by TSC is 3.9 Operating System use for Tableau Server is Windows Server OS 2012 Database version (for my data sources) is Microsoft SQL Server 2016 Enterprise edition