3 Replies Latest reply on Oct 24, 2016 11:11 AM by Jonathan Drummey

    Getting a Query automatically from Tableau 10 from different workbooks

    akhil priyatam

      Hi,

      I would like to know if i can somehow be able to collect or store all the tableau query's running that generally is stored in the logs of the repository. If let's say I have 3 workbooks with 5 sheets and 2 dashboards in each workbook. I would like to know the query that is being run in the background when we click on the data source or the sheets in tableau.

      I would like to avoid the pain of checking out the query for each data source or workbook by >Right clicking on the data source on top left> properties> and copying the Query from thenew small dialogue box that appears.

       

      Would like to know if we can some how get all the querys by a code or any other method.

        • 1. Re: Getting a Query automatically from Tableau 10 from different workbooks
          Jonathan Drummey

          Hi Akhil,

           

          I'm pretty sure what you're seeing in the dialog you referenced is just the Custom SQL for the data source, on the fly Tableau will dynamically generate queries and for that the only place to find them is either by the logs, using the Performance Recorder, or using a monitoring tool on your database side.

           

          I'm imagining you might be trying to apply "old school" BI techniques to working with Tableau. In general Tableau tries to issue the most efficient queries possible to the data source so looking at queries is only useful in some circumstances. In addition whenever possible Tableau tries to avoid querying the data source and instead use internal caching so monitoring queries only gives a limited perspective on what is going on with Tableau.

           

          The two most common reasons for looking at queries are:

           

          1) To try to improve performance. In this case then my first suggestion is to use this white paper Designing Efficient Workbooks | Tableau Software as that gives you very specific tips on how to get the best performance. Once you've implemented the performance tips in there (and one of the major tips is to avoid using Custom SQL) if you need to improve performance then looking at the queries can be useful. Tableau has the Performance Recorder to let us see the queries with some context and the logs. If you want a real-time view of the logs then I suggest you use a scripting language to parse the logs to show the queries as they come through. Also most databases also have monitoring tools for viewing queries as they come in.

           

          2) Trying to figure out how Tableau works. As someone who has deeply explored Tableau (including by looking at queries) I feel I can safely say that you are better off first thoroughly understanding Tableau's user interface and configuration because that is where most of the magic happens. Looking at the queries is useful in some cases (for example understanding why a calculated field using a Level of Detail Expression might be trashing performance) but not all.

           

          Jonathan

          • 2. Re: Getting a Query automatically from Tableau 10 from different workbooks
            akhil priyatam

            Hi, Jonathan,

             

            Thanks for replying.

            We only need the Custom SQL queries of the data sources that are used in the workbook and not the real time filtering tableau uses.

             

            Also is there a way to obtain /get the custom sql query without opening the workbook? only the data source!

            • 3. Re: Getting a Query automatically from Tableau 10 from different workbooks
              Jonathan Drummey

              You can open up the TWB of the Tableau workbook, it's an XML file and the Custom SQL query will be in there.