4 Replies Latest reply on Jun 7, 2016 8:24 AM by peter coppens

    Extract API w calc fields

    Chris Sommers

      Hi All,


      Our corporate team has a limit to the number of data refreshes per day to one, our BU's customers need a way for their dashboard to be refreshed with updated data every few hours during normal business hours.  We were informed that we could use the Tableau Extract API to create a tde and publish the tde to the corporate server (thus creating less stress on the corp server).  Our approach is:


      Create a Python script that runs on a schedule that:


      Queries oracle and creates a csv

      Creates a tde (use Tableau Extract API) of the csv

      Publishes (and overrides) the existing tde on the server



      My problem with my suggested approach is that we need to create calculated fields in the creation of the tde.  This does not seem possible with the Tableau Extract API.  Some of our existing calculations are LOD calcs to add to complexity.


      Does anyone have a workaround solution on how we can create a tde with calc fields via a script?





        • 1. Re: Extract API w calc fields
          Tamas Foldi

          You can create the tde file and build a data source (tds) on top of the tde.


          TDE will have your data, TDS will have your calculations and other metadata.


          Hope this helps.

          • 2. Re: Extract API w calc fields
            Chris Sommers

            Hi Tamas,


            Thanks for the reply.  Can you elaborate and provide a detailed process?




            • 3. Re: Extract API w calc fields
              peter coppens

              Chris, Tamas,

              Facing the same challenge. Any tips would be more than welcome!





              • 4. Re: Extract API w calc fields
                peter coppens

                I also ran into Refresh Data with an external TDE  and that seems to work.


                What I did (there might be a shorter solution, but after 4 hours of trying, I am leaving it at this for now)


                • Open a new workbook
                • Add a data source: in my case an Amazon Redshift table
                • Set this as an extract
                • Switch to the first empty sheet and save the tde somewhere locally
                • Publish the data source to Tableau server
                • Open a new workbook
                • Add a Tableau Server data source, namely, the one published before
                • Create worksheets with calculated fields
                • Publish the workbook to Tableau server
                • Create a data extract with some application that uses the  API.In my case a Python script that connects Redshift and selects the updated rows of the table that was previously used to create the data source. The selected rows are written to an extract using the tableau data extract api
                • Use tabcmd to publish / overwrite the tableau server data source
                • After refreshing the published workbook views now reflect the updated data


                I just hope this is a "supported" approach that does not break with some future version. I certainly could not find all this in the official Tableau docs.


                Hope this helps someone