Skip to main content

#Variables0 人正在讨论

Context:

We have two (2) Tableau Servers in where hundredths of reports dwell for users to make use of: workbooks with either .twb and .twbx extensions, all of them contain a SparkSQL connection type within which we embedded a Databricks token value to stablish the connection over to our Databricks server. Recently Databricks PAT (personal access token) policy changed and now tokens have a life time of 1 year, this situation means an impact for us and our users due to the token manual update is now needed to guarantee reports refreshes work correctly.

 

Challenge:

We're exploring a way in which by making use of TSC (Python's Tableau Server Client module) we can:

 

1. Download reports (.twbx type) from servers and store them locally

2. Unzip them and then modify the embedded .twb (.xml) connection settings

3. Zip the updated .twb alongside with its data source

4. Publish them back to the server within its source project

5. Verify the updated connection (from SparkSQL to Databricks OAuth) is set in a way the refresh tasks can go on with no issue

 

So far we've been able to develop a source code that addresses 1. to 4. items above, but when it comes to 5. after we publish the report back to the server the connection detail shows the following setting:

 

Is there a way to programmatically switch Spark SQL connection (with token value embedded) over to Databricks (OAuth) type enabling by which it wouldn't be possible a refresh to run with no problem.

 

Question:

Is there a way when we modify the embedded .twb (.xml) within a .twbx file to include some 'key:value' that allows the "Embedded credentials in the connection" in the image above to be enabled when the workbook is published back?

 

Following I share the DATABRICKS_DETAILS for the connection we're trying to update.

 

DATABRICKS_DETAILS = {

  'class':'databricks',

  'authentication':'oauth',

  'authentication-type':'OAuth',

  'oauth-config-id':'default',

  'username': --here comes our user name,

  'server': --here comes our server address,

  'dbname': --here comes our data base name,

  'v-http-path': --here comes http-path of our refresh resource in Databricks server,

}

5 个回答
  1. 2025年10月21日 19:56

    @David Rango​ 

    Hi, what instruction you are using for the step 4?. Pre publishing, have you verified the oauth credential has been set (my account settings - credentials) for the account you are using to publish the workbook/datasource?

     

    If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego Martinez

    Tableau Visionary and Forums Ambassador

0/9000

Hi all, I am trying to publish a workbook using snowflake Datasource with OAuth connection. I am setting oauth_flag = True and embed_credentials= True but it seems both are not working together at the same time. Also, adding connection_username but I am getting 400 response.

This is the response content :<Response [400]>

 

b'{"error":{"summary":"Bad Request","detail":"There was a problem publishing the file \'29003:ca5af2de7d4d45488135608dd1248e75-1:0\'.","code":"400011"}}'

Parameters are as follows:

response = conn.publish_workbook(

 

workbook_file_path= metadata_df.filepath,

 

workbook_name=metadata_df.workbook_name,

 

project_id=metadata_df.workbook_project_id,

 

show_tabs_flag= bool(metadata_df.show_tabs),

 

oauth_flag=True,

 

hide_view_flag=True,

 

workbook_views_to_hide= views_to_hide,

 

server_address='xyzz',

 

connection_username='abcd',

 

embed_credentials_flag=True )

 

This works fine if I remove embed_credentials_flag parameter

7 个回答
  1. 2022年7月12日 21:34

    @Jigyasa Kohli​ 

    Hi, could you try removing the server_adress='xyzz' from the instruction:

    @Jigyasa Kohli​ Hi, could you try removing the server_adress='xyzz' from the instruction:⌗publish_workbook If this post resolves the question, would you be so kind tohttps://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_workbooks_and_views.htm⌗publish_workbook

     

    If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego Martinez

    Tableau Visionary and Forums Ambassador

0/9000