Tableau Web Data Connector in FIVE lines of code
November 29, 2015
, , , , , , , , , ,

wdc_desktop_enter_urlAlmost a month ago, on 5th November I had the honor to present some of the Tableau Web Data Connector concepts with Information Lab’s Craig Bloodworth and InterWorks’ Robert Rouse during that month’s Think Data Thursday. While Robert explained the background and Craig showed intermediate topics I just showed how to write a new Tableau Web Data Connector from scratch for an actual use case (connect to Tableau’s Community Forums) in five lines of code, including workarounds for Cross-Origin Resource Sharing (CORS) limitations.

It wasn’t my best performance but I hope the message came thru:  by using the right frameworks and right programming languages you can write these connectors without getting your hands dirty.

This is the recording, feel free to start from the beginning. My part is from 39:50, it begins with some boring stuff but after a few mins from I ramp up my vim  it starts to be fascinating.

tl;dw: just scroll down.

Let’s consider that you’re so highly paid that you have no time to watch tutorial videos, so let me just grab the summary.

The Goal

There are several communities in the Tableau Community space (like this). Why don’t we create a small WDC that just grabs all contents for a tag?

After googlin’ a few hits I’ve found the Jive (this is the software behind Tableau Community) has a nice JSON API. It gives back whatever you want include tag based searches. Just navigate to this REST URL and you will see what I am talking about:,discussion).

The Five Lines of Code

Well, first of all you need to get the framework and build your project template. Our framework is not as advanced as Eric Peterson’s Yeoman based one, but it has its own tricks. First of all, I can’t stand javascript (I appreciate its features, it’s cool but still, no thanks). So mine is in coffescript.

Getting the framework ready

You must have node installed on your computer, preferably on some *nix clone OS. Windows can work if you have unixtools installed (sh, sed) and git.

Downloading the framework:

Getting the dependencies:

Creating the starter template:

All set. Ready for that five lines of code.

Implementing the WDC

This is the complete code base for the connector highlighted only those lines that were changed in the initial template.

The complete WDC is 50 lines of code but we changed only five of them. But what are these five lines?

  • Line 12: The returned web resource is not JSON (see line 14 comment) as the first line is not a JSON expression. We should instruct jQuery to not try to parse the result as JSON.
  • Line 14: If you check this URL its first line is garbage, it’s for protecting that URL for brainless includers. We just simply ignore the first line from the returned JSON
  • Line 16: Convert back to JSON the rest of results.
  • Line 36: The URL what we need to fetch. data.tags  is filled with the contents of the start form. It will be the tag what we are looking for. Why it starts with http://localhost:1337 ? Read more to find that out.
  • Line 53: metadata for the columns

And yes, if the result would be real JSON to implement a WDC would take only two lines (or even less). The first three line is to interpret the results, one for the URL one for the headers def.

User interface

We need to get some user input, like the tags what we are looking for. For this I simply added an input text field in start.jade :

Building and running

Just build the HTML with:

and use the generated HTML (stored in /dist) from Tableau Desktop.


Tableau community API does not allow other browsers (like Tableau Desktop) to connect directly. Since it does not allow direct connection we need to proxy it with something that adds the necessary, missing headers. During the show I used Gregor Martynus’ corsproxy which is a dead simple solution for CORS limitation. Just install it ( npm install -g corsproxy ), start it, and add http://localhost:1337  (leet) for every URLs. It will just work. Out of the box.


It was missing from the video, but you can add pagination easily:

First time URL should be the connection_data ‘s url field while after the first page we take it from the returned JSON object.


It’s so easy to write a WDC. Five lines, really. If you need one there are no excuses, you should do it for yourself!

Or ping me 😉

Tamás Földi

Tamás Földi

Director of IT Development at Starschema
Decades of experience with data processing and state of the art programming. From nuclear bomb explosion simulation to distributed file systems. ethical hacking, real time stream processing practically I always had a great fun with those geeky ones and zeros.
Tamás Földi

Related items

/ You may check this items as well

Tableau Consistency Checker

Tableau Filestore Consistency Checker – How Repository Maps to Filestore

Almost a month ago, on 5th November I had the hono...

Read more

Pushing the Limits of Tableau Server – Practical Lessons from a Zen Master

Almost a month ago, on 5th November I had the hono...

Read more
Sales dashboard embedded into SAP GUI

Embed Tableau Dashboards in SAP ERP and S4/HANA

Almost a month ago, on 5th November I had the hono...

Read more