tableau / document-api-python

Create and modify Tableau workbook and datasource files
https://tableau.github.io/document-api-python/
MIT License
326 stars 178 forks source link

Change Tableau Published Data Source #251

Open difemaro opened 9 months ago

difemaro commented 9 months ago

Hi Devs!

While working with Governance, it is common that the staging workbook is connected a Tableau published data source, let's call it PUBLISHED DATA SOURCE A. Is it possible, that using document api, we can change the published data source of the workbook to PUBLISHED DATA SOURCE B?

Don't forget we are talking about published data sources. I am not asking to change the databases or anything related to the published data sources. I just want to change the Tableau published data source the workbook is using (in this case from PUBLISHED DATA SOURCE A to PUBLISHED DATA SOURCE B)

Regards,

Diego Martinez Tableau Visionary and Forums Ambassador

bryceglarsen commented 8 months ago

Hi @difemaro, Fancy meeting you here! Yes, this is possible. While it's a published datasource it is still treated as a common connection and you simply need to update the dbname. Here's how we do it in my org:

  1. Find Datasource B using its name and project with TSC
  2. Return the datasource object and update the connection information from Datasource A to that of Datasource B within the Document API.
  3. Save and enjoy :)
vahidkowsari commented 7 months ago

Hi @difemaro and @bryceglarsen and thank you both.

I need to do the same thing and have the whole skeleton for a command line program to do this, however this library does not offer a way to update the connection information for a workbook, it just returns the datasources. Am I missing something?

For us we keep the following structure Dev

When we promote the code we copy the data source and workbooks from Dev to QA and higher envs. I do update the data sources dbnames to point to the correct env db name, however I havent been able to programatically update the workbook's data source in QA after copying the daashboard 1 data source from Dev.

Basically what we do during deployment of a new version.

  1. Download data source for a project
  2. Download the workbook for a project
  3. Change the DB name of the data source from step 1 to the higher env dbname
  4. Publish the updated data source to the higher env
  5. Change the workbook to point the new updated data source in step 4 (this is the step I dont know how to do)
  6. Publish the updated workbook to the higher env

Any help is appreciated.

Thanks