2 Replies Latest reply on Aug 25, 2016 8:45 AM by Andy Gilbertson

    How to bulk change database URL for multiple Data Sources on Tableau Server?

    Andy Gilbertson

      I am currently moving one of our core company databases to a new URL. This database is used in well over a hundred Tableau Data Sources on our Tableau Server deployment (both extracts and live queries, published and embedded). How can I change the connection URL in all of these Data Sources? Any API or Server functionality that would allow me to do this?

       

      I'm trying to avoid having to manually open up each workbook, and then edit and re-publish every single connection.

        • 1. Re: How to bulk change database URL for multiple Data Sources on Tableau Server?
          Mason Forando

          Hi Andy,

           

          I'm not too familiar with Tableau Server and don't know that this would work for your use case, but with raw tableau workbooks you can change connection information by parsing the underlying XML, replacing with a new value, and then saving that back as a .TWB file.  For example, here is the start of the XML code for one workbook:

           

          <?xml version='1.0' encoding='utf-8' ?>

          <!-- build 9300.16.0315.0125                                -->
          <workbook source-build='9.3.0 (9300.16.0315.0125)' source-platform='win' version='9.3' xmlns:user='http://www.tableausoftware.com/xml/user'>
            <preferences>
              <preference name='ui.encoding.shelf.height' value='24' />
              <preference name='ui.shelf.height' value='26' />
            </preferences>
            <datasources>
              <datasource caption='Mock TDE Extract' inline='true' name='dataengine.1wha8gx0mft71t10ykj4l1y94maw' version='9.3'>
                <connection class='dataengine' dbname='C:\Users\Desktop\Tableau\Mock TDE.tde' schema='Extract' tablename='Extract'>
                  <relation name='Extract (Extract.Extract)' table='[Extract].[Extract]' type='table' />
                  <metadata-records>

           

          Changing the file path to a new TDE and resaving worked for me.  I'm not sure how this would need to be tweaked for non-extract workbooks, but I'm sure the connection information is in the XML as well.

           

          You would need to automate downloading the workbooks from server, update connection information, resave as .TWBs, and then republish them back to server after processing.  Like I said, I'm not familiar with server but this works on local tableau workbook files.

          • 2. Re: How to bulk change database URL for multiple Data Sources on Tableau Server?
            Andy Gilbertson

            Pretty sure I found the answer to my own question... I does look like the REST API would allow me to do exactly what I'm looking to do: Reference-Tableau Server REST API