Tableau is a popular commercial data visualization tool. In addition to a large number of built in connectors, it also provides generic database connectivity via ODBC and JDBC connectors.
Tableau has two main versions: Desktop and Online (Server).
- For Desktop, connecting to a DuckDB database is similar to working in an embedded environment like Python.
- For Online, since DuckDB is in-process, the data needs to be either on the server itself or in a remote data bucket that is accessible from the server.
When using a DuckDB database file
the data sets do not actually need to be imported into DuckDB tables;
it suffices to create views of the data.
For example, this will create a view of the
h2oai Parquet test file in the current DuckDB code base:
CREATE VIEW h2oai AS (
Note that you should use full path names to local files so that they can be found from inside Tableau. Also note that you will need to use a version of the driver that is compatible (i.e., from the same release) as the database format used by the DuckDB tool (e.g., Python module, command line) that was used to create the file.
Tableau provides documentation on how to install a JDBC driver for Tableau to use.
Tableau (both Desktop and Server versions) need to be restarted any time you add or modify drivers.
The link here is for a recent version of the JDBC driver that is compatible with Tableau. If you wish to connect to a database file, you will need to make sure the file was created with a file-compatible version of DuckDB. Also, check that there is only one version of the driver installed as there are multiple filenames in use.
Download the snapshot jar
- macOS: Copy it to
- Windows: Copy it to
- Linux: Copy it to
If you just want to do something simple, you can try connecting directly to the JDBC driver and using Tableau-provided PostgreSQL dialect.
- Create a DuckDB file containing your views and/or data.
- Launch Tableau
- Under Connect > To a Server > More… click on “Other Databases (JDBC)” This will bring up the connection dialogue box. For the URL, enter
jdbc:duckdb:/User/username/path/to/database.db. For the Dialect, choose PostgreSQL. The rest of the fields can be ignored:
However, functionality will be missing such as
percentile aggregate functions.
To make the data source connection more compatible with the PostgreSQL dialect,
please use the DuckDB taco connector as described below.
While it is possible to use the Tableau-provided PostgreSQL dialect to communicate with the DuckDB JDBC driver, we strongly recommend using the DuckDB “taco” connector. This connector has been fully tested against the Tableau dialect generator and is more compatible than the provided PostgreSQL dialect.
The documentation on how to install and use the connector is in its repository,
but essentially you will need the
The current version of the Taco is not signed, so you will need to launch Tableau with signature validation disabled.
(Despite what the Tableau documentation says, the real security risk is in the JDBC driver code,
On Linux, copy the Taco file to
On Windows, copy the Taco file to
Then issue these commands to disable signature validation:
$ tsm configuration set -k native_api.disable_verify_connector_plugin_signature -v true
$ tsm pending-changes apply
The last command will restart the server with the new settings.
Copy the Taco file to the
/Users/[User]/Documents/My Tableau Repository/Connectors folder.
Then launch Tableau Desktop from the Terminal with the command line argument to disable signature validation:
$ /Applications/Tableau\ Desktop\ ⟨year⟩.⟨quarter⟩.app/Contents/MacOS/Tableau -DDisableVerifyConnectorPluginSignature=true
You can also package this up with AppleScript by using the following script:
do shell script "\"/Applications/Tableau Desktop 2023.2.app/Contents/MacOS/Tableau\" -DDisableVerifyConnectorPluginSignature=true"
You can then double-click it to launch Tableau. You will need to change the application name in the script when you get upgrades.
Copy the Taco file to the
C:\Users\[Windows User]\Documents\My Tableau Repository\Connectors directory.
Then launch Tableau Desktop from a shell with the
to disable signature validation.
Once loaded, you can run queries against your data! Here is the result of the first H2O.ai benchmark query from the Parquet test file: