Using Tableau to visualize data in TimescaleDB
This tutorial covers:
- Setting up Tableau to work with TimescaleDB
- Running queries on TimescaleDB from within Tableau
To complete this tutorial, you need a cursory knowledge of the Structured Query Language (SQL). The tutorial walks you through each SQL command, but it is helpful if you’ve seen SQL before.
To start, . When your installation is complete, you can proceed to ingesting or creating sample data and finishing the tutorial.
Also, get a copy or license of Tableau.
You also want to , as it sets up and configures the data you need to complete the remainder of this tutorial. You can visualize many of the queries found at the end of the Cryptocurrency tutorial.
Locate the , port
, and of your TimescaleDB instance.
Connecting your TimescaleDB instance to Tableau takes just a few clicks, thanks to Tableau’s built-in Postgres connector. To connect to your database add a new connection and under the ‘to a server’ section, select PostgreSQL as the connection type. Then enter your database credentials.
Type a query in the dialog box. In this case, use the first query from the Cryptocurrency Tutorial:
You should see the same results in Tableau that you see when you run the query in the psql
command line.
Let’s also name our data source ‘btc_7_days’, which you can see below.
Results in a table are only so useful, graphs are much better! So in our final step, let’s take our output from the previous step and turn it into an interactive graph in Tableau.
To do this, create a new worksheet (or dashboard) and then select your desired data source (in our case ‘btc_7_days’), as shown below.
To put it in more direct terms, July 4, 1776 is still July 4, 1776, even if the price of tea skyrockets. However, the price of tea may change, depending on which day you are looking into.
So, in this case, move the dimension into the Columns section of your worksheet, and examine the last_closing_price
measure depending on a given . In Tableau, you can drag and drop these elements into the proper place, like this:
Now this graph doesn’t quite have the level of fidelity you want because the data points are being grouped by year. To fix this, click on the drop down arrow on period and select ‘exact date’.
Tableau is a powerful business intelligence tool and an ideal companion to data stored in TimescaleDB. This tutorial only scratched the surface of the kinds of data you can visualize using Tableau.
In this tutorial, you learned how to setup Tableau to examine time-series data stored in TimescaleDB.