How to connect Tableau to Google Cloud Spanner DB
As we continue to observe companies migrating their workloads to the cloud, fans of the traditional relational model, who also need a globally-distributed database, may find Google Cloud Spanner offers an irresistible combination of those things.
What was missing until now was the ability tap and explore this amazing database with the most awesome Visual Analytics Platform in the planet 😊.
Not familiar with Spanner? Here is a short overview from GCP Blog:
In this post I’ll show you how to connect Tableau to Spanner via the Generic JDBC connector in a few easy steps:
(Note: This solution only works with Tableau version 2019.3 and up)
- On GCP console, create a Service Account and grant it an appropriate machine role, for example
- On GCP console, create and download a JSON Private key file to the machines you run Tableau Desktop and Tableau Server.
- Download the latest Simba JDBC Driver for Google Cloud Spanner (version 4.2 compatible, for Java 8.0 and greater).
- Place the .jar files in the folder for your operating system (you need to create the folder if it doesn’t already exist):
- Windows: C:\Program Files\Tableau\Drivers
- Mac: ~/Library/Tableau/Drivers
- Linux: /opt/tableau/tableau_driver/jdbc
5. Make sure 64-bit Java 8 or newer is installed on the machine. Also make sure the account running Tableau (Desktop and Server has permissions to access this .jar file)
6. In order for Tableau to talk to Spanner over Simba’s JDBC driver, we need to create a custom Tableau Data Customization (.tdc) file as follows:
7. Save this .tdc file under the following location(s), depending on your Operating System (the name does not matter, as long as the extension is .tdc):
- Tableau Desktop:
Documents\My Tableau Repository\Datasources
- Tableau Server — Windows:
- Tableau Server — Linux:
Restart Tableau Desktop and/or Tableau Server after placing the .tdc file on these locations!
8. On Tableau Desktop, connect to datasource with the “Other databases (JDBC)” connector and configure as follows:
- URL example (replace information under brackets):
- Dialect: MySQL
8. Hit “Sign In” and you should be able to analyse your data in Tableau Desktop:
9. Share this datasource with your colleagues via Tableau Server. Make sure you have saved both the Simba .jar JDBC driver, as well as the custom .tdc file on their appropriate locations for this to work.
Tableau support for Other Databases (ODBC) connections
It’s worth mentioning that Tableau provides limited customer support for connections using Other Databases (ODBC/JDBC). Tableau supports the Other Databases (ODBC/JDBC) connector functionality, for example, Support will help you with the sample code provided in Tableau documentation, or if your connection works in Tableau Desktop, but doesn’t work in Tableau Server. However, Tableau does not support creating or debugging custom TDC files. For help, you can review the documentation listed under Other Databases (ODBC), and you can submit questions and ask for help on the Tableau Developer Community forums.
I’d love to hear what kinds of use cases you have been using Tableau + Google Cloud Spanner for.
Also, let me know if you found any bugs in this article or have any feedback for this integration.