10 Replies Latest reply on Jul 23, 2015 1:09 PM by Biyin Cai

    How to upload dashboard using script

    Biyin Cai

      Hi,

       

      I'm trying to upload my reports with db username and password embedded to Tableau Server (v9.0) using tabcmd. I don't want to expose the database credentials to the person who is doing the upload so I'm planning to store the database credentials in some config file and write some script to upload the reports using tabcmd. However, I found a problem that the 'tabcmd publish' command does not provide me any option to choose which tabs I want to publish and every single tab (worksheet + dashboard) in my workbook were published.


      Is there any way that allows me to publish only the dashboard and excluding the worksheets? Or is there any other approach that allows me to upload the Tableau dashboards without knowing the database credentials?

       

      Any suggestions will be appreciated.

       

      Thanks

        • 1. Re: How to upload dashboard using script
          Jeff Strauss

          It's all or none as far as I know, using tabcmd you can publish the entirety of the workbook.  I know within desktop you can hide certain tabs, but I don't see this as a possibility within tabcmd at the moment.  Also, by the way, the password is encrypted when uploaded to the server so as long as you have it in a secure config file, the person doing the upload shouldn't be able to view anywhere.

          • 2. Re: How to upload dashboard using script
            Damien Lesage

            Hi,

             

            As said Jeffrey, it's all or nothing. That being said, we had the same issue and decided to enforce that all sheets were used in a dashboard and hidden to make sure only the relevant dashboard were published to the server.

             

            We enforce this using a script that is part of our Tableau release process.

             

            Damien.

            • 3. Re: How to upload dashboard using script
              Biyin Cai

              Hi Jeffrey,

               

              So you mean that even if I hide the worksheets in Tableau Desktop, tabcmd will still publish all tabs in my workbook and there's no way to do the upload few specific dashboards? Is there any other way to publish the workbooks other than tabcmd/upload manually from Tableau Desktop that allows me to select specific dashboards?

               

              Thanks

              • 4. Re: How to upload dashboard using script
                Jeff Strauss

                not that I've run into.  I'm curious, what is the use case for publishing new content via tabcmd?  I've used it for datasources, but not workbooks.

                • 5. Re: How to upload dashboard using script

                  You could consider using the REST API's. This has a <connectionCredentials> element you can pass in the request body of the API call.

                   

                  http://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm#REST/rest_api_ref.htm#Publish_Workbook

                  • 6. Re: How to upload dashboard using script
                    Matt Coles

                    I wrote a script that tries to mirror a workbook published to Server A on Server B using tabcmd. The only way I found to replicate it with the proper views being published was to hack the XML of the .twb file once I had downloaded it. It kind of sucks. See attached for the function I wrote in Powershell to do this, which accepts an input file and a set of view names that you DO want published. This expects an UN-packaged workbook--a .twb, not a .twbx. If you have a .twbx you'll need to unzip it first to get the twb, do your surgery, then re-zip so you can publish.

                    • 7. Re: How to upload dashboard using script
                      Biyin Cai

                      Hi Jeffrey,

                       

                      The reason why I need to use a script to upload the report is that we don't want the person who does the upload process know the credentials of the production database - if you upload the report using Tableau Desktop, you need to input the database credentials in order to publish and embed the password. My reports are embedded in our web application. Like how we deploy the web application to production server, we want to have some similar automation process (script) that does the 'deployment' for the Tableau reports and the deploy person does not need to know the database credentials.

                       

                      But the way, how are you using the uploaded data sources from Tableau Server? I'm using a db account that is accessible to the database only when the request is sent from my Tableau Server. I uploaded the data source to the server with embedded password but it kept asking me for password when I tried to connect from that datasource.

                       

                      Thanks

                      • 8. Re: How to upload dashboard using script
                        Biyin Cai

                        Hi Neelesh,

                         

                        I added connectionCredentials element in my request body and tried to use the Java code to make a post call using REST API to publish the report but I'm getting the below error:

                        HTTP statuserror CodeConditionDetails
                        400400000Malformed request bodyThe XML content in the MIME multipart request is not empty.

                         

                        If I don't add the connectionCredentials element, I got error Code 400011.

                         

                        Note: I have 3 data sources in my workbook but all data sources are connecting to the same database and using the same credentials. Do you have any idea why the above error happen?

                         

                        Thanks

                        • 9. Re: How to upload dashboard using script
                          Jeff Strauss

                          I understand your need.  The way we avoid the use of prod credentials is that the analysts upload the workbook with their own credentials.  It doesn't really matter if they choose embed or prompt option because prior to the nightly schedule running we have a script that updates all the db connections to use the prod credentials.  It leverages the REST API functionality to do this.

                           

                          We're using published data sources instead of local extracts specific to each workbook.

                          • 10. Re: How to upload dashboard using script
                            Biyin Cai

                            Hi Jeffrey,

                             

                            How are you updating the data source to use prod credentials? Does connecting to the published data source behave the same as connecting to my live database? Do I need to schedule some 'refresh' job to update the data like the extracts?

                             

                            Thanks