Tableau Error: Unable to connect to the data source

After a fresh Tableau Server install, if you haven't installed PostgreSQL database drivers, you will run into this error when trying to view a Tableau Dashboard that has a live connection to PostgreSQL.

Error: Unable to connect to the data source.

Download the PostgreSQL database drivers from Tableau

This post assumes you have Tableau Server installed on a Ubuntu operating system.

Find the latest PostgreSQL database drivers on Tableau's Driver Download page.

Tableau Driver Download page, PostgreSQL Linux 64-bit
Data Source PostgreSQL
Operating System Linux
Bit Version 64-bit

Copy the URL of the Download button.

Tableau Driver Download page, Debian .deb file, command, Ubuntu

On the Tableau Server's command line, download the file with wget and paste the copied URL.

For example:

cd ~
wget https://downloads.tableau.com/drivers/linux/deb/tableau-driver/tableau-postgresql-odbc_09.06.0501_amd64.deb

Results:

ubuntu@tableau-server:~$ wget https://downloads.tableau.com/drivers/linux/deb/tableau-driver/tableau-postgresql-odbc_09.06.0501_amd64.deb
--2020-06-28 21:52:11--  https://downloads.tableau.com/drivers/linux/deb/tableau-driver/tableau-postgresql-odbc_09.06.0501_amd64.deb
Resolving downloads.tableau.com (downloads.tableau.com)... 23.192.28.189
Connecting to downloads.tableau.com (downloads.tableau.com)|23.192.28.189|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 613620 (599K) [text/plain]
Saving to: ‘tableau-postgresql-odbc_09.06.0501_amd64.deb’

tableau-postgresql-od 100%[========================>] 599.24K  --.-KB/s    in 0.004s  

2020-06-28 21:52:11 (133 MB/s) - ‘tableau-postgresql-odbc_09.06.0501_amd64.deb’ saved [613620/613620]

Install the PostgreSQL database drivers

On the Tableau Server's command line, install the Tableau PostgreSQL ODBC driver with gdebi:

For example:

sudo gdebi tableau-postgresql-odbc_09.06.0501_amd64.deb

Results:

ubuntu@tableau-server:~$ sudo gdebi tableau-postgresql-odbc_09.06.0501_amd64.deb 
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done

PostgreSQL ODBC Driver\nThis package includes the driver needed for applications to access a PostgreSQL system via ODBC (Open Database Connectivity).
Do you want to install the software package? [y/N]:y
Selecting previously unselected package tableau-postgresql-odbc.
(Reading database ... 144767 files and directories currently installed.)
Preparing to unpack tableau-postgresql-odbc_09.06.0501_amd64.deb ...
Unpacking tableau-postgresql-odbc (09.06.0501) ...
Setting up tableau-postgresql-odbc (09.06.0501) ...

Test connectivity on Tableau Server

Navigate back to your dashboard on Tableau Server and make sure the it renders properly without error.

Tableau Server data visualization example

PRO TOOL RECOMMENDATIONS:

The Mitto ELT solution can bring together data from a myriad of sources, all prepped and ready for Tableau.

Zuar's Rapid Portals are an easy way to provide branded Tableau dashboards to the audiences you serve. Monetize your data with this white-labelled solution, or provide secure access to those outside of corporate firewalls. Zuar is a National Tableau Partner with trusted solutions and certified consultants. We can help you every step of the way.  You can learn more about Rapid Portals here.  

PostgreSQL - upsert - creating a table with created at and updated at columns
Here’s how you can create a new table (or update an existing table) in PostgreSQL that has the right table structure for upsert (primary key and last modified column). Let’s start by creating a basic table and inserting a record into it: CREATE TABLE test.test_updated_at ( id SERIAL, …