TabPy + Heroku = Tableau Online

Paolo Ferraiuoli
Jan 22 · 5 min read
Photo by Nicki Eliza Schinow on Unsplash

Tableau analytics extensions are finally available for Tableau Online! Now, it is possible to unlock the power of data science programming languages including Python/R within the visual analytics cloud solution of Tableau.

However, before enabling analytics extensions in Tableau Online, there are a couple of things to consider as described here. In particular, Tableau Online requires a valid TLS/SSL certificate configured on the server running the external service (e.g. TabPy or Rserve) and authenticated access to this (see here, for posts related to security and authentication for analytics extensions in Tableau).

This guide aims to describe a quick method to make you up and running with analytics extensions in Tableau Online without going through the process of i) installing the external service on a server and ii) configuring certificates.

The solution discussed here will allow you to create a quick TabPy instance that can be accessed from everywhere via the internet thanks to Heroku (“a cloud platform that lets companies build, deliver, monitor and scale apps — we’re the fastest way to go from idea to URL, bypassing all those infrastructure headaches”).

Let’s go 🚀! There are mainly three steps to follow:

  • The first step is to create a fork of TabPy to configure TabPy with authentication (not set by default) and to require username and password
  • The second step is to deploy your forked TabPy in Heroku
  • The final step is to enable the analytics extension in your Tableau Online site.

Before, there’s a small hack to generate the username and password credentials (TabPy at the moment uses PBKDF2 method with 10000 iterations to hash the password). What I did was to run on my laptop TabPy (if you don’t have it installed, check here to see how to install TabPy) and execute the command to add a user and store its credentials in a text file I previously created (tabpypwd.txt).

The command to execute in the prompt is the following:

tabpy-user add -u paolo -f C:\Users\Paolo\tabpypwd.txt -p P@ssw0rd

which requires the username to add (-u), the path to the text file (-f) and the password chosen (-p). You can check the password file that will look like this:

paolo e846a223713a517b81ae2cbcc8e4cb03845cf02ad2bb4b572e30efc89119b12d3bdd11e03826d2d64f30dc638b53b9ddbf482509dd1602cd2b45a38979f8d1bf

You can now add and commit the password file (tabpypwd.txt) to your TabPy forked repository.

The final thing to do in this first step is to enable authentication for TabPy. To do that, in your TabPy fork go to the tabpy/tabpy_server/common directory and edit the following line in the default.conf file:

TABPY_PWD_FILE = ./tabpypwd.txt

removing the comment and specifying the absolute path to the password file in your TabPy repository.

Now, that you have your TabPy authentication enabled and user configured, you’re ready to deploy your app in Heroku.

For this task, even a free Heroku account is sufficient and you can register here.

Once you have your Heroku account, deploying your TabPy application is very simple as you can find, in the README section, an option to deploy to Heroku (as also described here).

In Heroku, give a name to your app and click Deploy app.

If the application has been successful installed, configured and started, you will see all these green marks.

To test whether TabPy authentication has been enabled correctly, access the application clicking the View button. A new tab in your browser will be open and you should be prompted to enter the username and password created previously.

Once entered the credentials, you should be able to see the TabPy Server Info with authentication required set to true and method to basic-auth.

Hurray 🎉! You have your TabPy instance running and accessible from everywhere. More importantly, you don’t have to install and configure any certificates. In fact, you can leverage the Heroku certificate issued by DigiCert to ensure a secure connection to Tableau Online.

The final step is to enable the analytics extension in your Tableau Online site:

  • In your Tableau Online site, go to Settings and select the Extensions tab.
  • In the Analytics Extensions section, check the option to Enable analytics extension for site and Create new connection.
  • For Connection Type, select TabPy/Analytics Extension and fill up the Hostname with the URL to the deployed Heroku app (in this example tabpy-x-tableau-online.herokuapp.com) and use Port 443 to force secure connection (HTTPS).
  • Finally, insert the Username and Password.

Congrats 🎉! You have your TabPy up and running (which you don’t have to maintain) and ready to be used in Tableau Online to unleash the power of data science and Tableau visual analytics completely in the cloud.

The final suggestion, if you want to stay up to date with all the developments of Tableau and data science tools, I recommend checking periodically this blog tabscifi.com.

The Startup

Get smarter at building your thing. Join The Startup’s +745K followers.