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.
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!
You can open up the TWB of the Tableau workbook, it's an XML file and the Custom SQL query will be in there.