In this post I will explain how to connect to the Tableau repository using Tableau Desktop and SQL Developer. Both which are handy for querying the repository data.
- Enable access to PostgreSQL repository DB– set a password for the username ‘tableau’:
C:\Program Files\Tableau\Tableau Server\8.1\bin>tabadmin dbpass <password>
- Create a firewall rule to allow remote access of PostgreSQL:
- Windows Firewall > Advanced Settings
- Create New Rule
- Configure a Port specific rule
- Create a rule for TCP – 8060 (the default port used by Tableau for PostgreSQL)
- Keep on default
- Keep on default (allow access from all networks) or modify per your requirements
- Give the rule a name and description
- Create a Tableau report
- Open Tableau Desktop
- Connect to Data
- Select PostgreSQL
- Enter the connection details
- Example of a Custom SQL query I created to retrieve audit data:
select count(*), ET.name as event_name, U.name as user_name, W.name as workbook_name, VW.name as view_name, VW.repository_url from historical_events E left join historical_event_types ET on (E.historical_event_type_id = ET.type_id) left join hist_users U on (E.hist_actor_user_id = U.id) left join hist_workbooks W on (E.hist_workbook_id = W.id) left join hist_views VW on (E.hist_view_id = VW.id) where created_at >= '2015-12-01 00:00:00.000' and VW.name is not null group by ET.name, U.name, W.name, VW.name, VW.repository_url
- Example of pie chart showing user usage
- Connect using SQL Developer
- Download JDBC Postgresql driver for SQL Developer:
http://jdbc.postgresql.org/download.html#current - Open recent version of SQL Developer (example uses version 4.0.3.16)
- Setup the JDBC driver in SQL Developer
- Create new connection
- Create a new connection
Note that by default SQL Developer is attempting to connect to a database name which is the same as the username (database: ‘tableau’) without an option to choose a database.
The next steps illustrate a workaround to fix this issue - Save the connection
- Export the Connection:
Connections > Export Connections
- Select Connection
- Save XML file
- Open XML file in notepad and point the connection to the database: ‘workgroup’
- Modify the row:
<Contents>jdbc:postgresql://<server name>:8060/</Contents>
- Add an indication of ‘workgroup’ database
<Contents>jdbc:postgresql://<server name>:8060/workgroup</Contents>
- Save
- Modify the row:
- Import XML file
- Open connection details
Note that now the connection is showing ‘workgroup’ as the chosen database.
You can now add your password and connect to the Tableau Repository using SQL Developer.
- Create a new connection
- Download JDBC Postgresql driver for SQL Developer: