One thing that I realised in Austin: I’m not a Tableau Desktop guy. I’m struggling sometimes even with the easiest densification calcs and my dashboards generally suck. What can I do? Learn Desktop, deep dive and share my findings. Well, I did and the results are below.
Going back to Austin. I spend two hours in the Hackatlon with a Tableau employee called Paul Howie. While he wrote a clever password manager (LastPass) integration to Tableau Desktop I spent most of my time to understand Desktop’s architecture especially the Qt GUI layer (but at the end of the day I did integrate Sever with LastPass as well). We were both pissed off that we did not make into the top three? Honestly, how many people struggle with copying pass database password to Desktop (a lot) vs integration Amazon Alexa with a 3rd party commercial product (a few). And there is no better motivation than resentment (hear me, Ben Lower?) so I started to plan my ultimate solution to open up Tableau Desktop as platform for the masses.
So this is the first part of my journey to write a web REST API for Tableau Desktop (yes, in Tableau Desktop, yes a Tableau REST API) starting with the basics. At the end of this series you will able to inject a web server into Desktop and call tabdoc commands from a nice web UI. Let’s get started.
First of all, nothing is supported and only applies to current Desktop versions (10.1 release).
Switching experimental/internal features on
Shipping products with experimental features in disabled state is not an uncommon software development practice. Tableau does the same: viz in tooltips, web data connector debugging and other similar features are already in Tableau since a while. You just have to turn them on.
What are the options? You can easily get this information for workgroup.yml’s “feature.” section. When it’s false, it’s turned off but with tabadmin set you can turn on of course. Here is an example of the features:
If you want to play with VizInTooltips just add -DOverride=VizInTooltips as a parameter to Tableau binary, and voila, you have viz in tooltips. Credit to Craig Bloodworth, who showed me first how these Server features work in Desktop. But hey, this is a Desktop post so let’s not cheat and get this information straight from Desktop.
These options are most probably string literals specified in compile time. Our chances that we found them in the binary libraries .data section is relatively high. Let’s give a try using my favorite radare2:
Great, here we have even more features than in the Tableau Server workgroup.yml config file. If you scroll up you can see the non-override (AppConfig) based values, like -DJdbcHeapSize or -DDebugMenu .
And if you look carefully you might find my favourite: the DebugMenu. I learned this from Samm Desmond during the Hackatlon and eventually it turned out it’s a treasure for me.
DebugMenu: Control the Qt UI
After starting Tableau Desktop with debug menu ( -DDebugMenu ) we can start interacting with Tableau’s own debug user interface.
Two important options here: Widget Sandbox and Script Command. Let’s start with Sandbox. Sandbox is essentially a GammaRay like in-process debug tool that helps people to see and understand Qt crap. Signals, slots, object properties, parents-childs and their attributes. My guess that it was designed and implemented by the same KDAB developer team who did GammaRay. The similarities are obvious. But what can it do?
You can pick a UI element and change it as you want. Don’t like the Tableau logo or Connect label? You can change it pretty easily:
Trust me, even if it looks like a toy this is actually a very powerful tool. You can change the look and feel, behaviour and almost everything inside Desktop. Note: we can control Tableau GUI.
But the life isn’t just UI. Can we control Tableau itself? Like automate everything what we do in the vizql space? I know you know the answer: of course we can. Script commands is an easy interface that allows us to send tabdoc and tabui vizql commands. What can you do with these functions? You can do anything what Tableau can do:
I hope now you get it. If you control the UI (you can access the Qt object registry) and you are able to issue vizql commands you can do anything. No limits.
That’s why I started to build my own Tableau Desktop API kit. But wait. There is more.
Originally my plan was to implement my API using the fantastic GammaRay (by KDAB who I guess helped Tableau to build their DebugMenu) but GammaRay was not stable enough (it’s pretty intrusive since its hooking methods with pure memory image patching). I loved the features but I needed only just the subset plus the vizql commands.
Still, it was very useful to get more information on how Tableau works behind the scenes.
You can search and monitoring everything. Quick example: are you interested in keyboard shortcuts? See them and change if you want:
My question during the Tableau hackatlon was: can I build something like GammaRay, DebugMenu and Script Window but from command line or software libraries? What’s your guess?
Injecting a webserver into Tableau Desktop to provide a pluggable HTTP REST API to control Qt and Vizql APIs. Nothing more, nothing less. Have questions? Ask them.