QBoard » Advanced Visualizations » Viz - Tableau » Access non-public PostgreSQL DB from Tableau Desktop through Tableau Server

Access non-public PostgreSQL DB from Tableau Desktop through Tableau Server

  • Reading through the documentation of Tableau Server I was not able to determine if the following works:

    • I have set-up Tableau Server 2020.4.0 along with the PostgreSQL driver
    • I added a connection to an internal, i.e. non-public, PostgreSQL DB via Tableau Server
    • I can access the PostgreSQL via logging in to Tableau Server just fine

    I am also able to connect to the Tableau Server through Tableau Desktop BUT I cannot connect to the PostgreSQL as it is not directly accessible from the client machine running Tableau Desktop.

    Is there a way to access this non-public PostgreSQL database connected to Tableau Server from Tableau Desktop through Tableau Server?

      November 8, 2021 2:59 PM IST
    0
  • Answering my own question and following @matt_black's comment it is indeed possible to access and use published Datasources from Tableau Desktop which are not directly accessible.

    For that you need to login to the Tableau-Server UI (not TSM via 8850), create a Workbook, click on "Datasource" (bottom left hand corner) add a single or multiple connections and then head back to any "Sheet" Tab (also bottom left hand corner).

    At this point it is recommended to save the Workbook as "Template", i.e. "my_published_datasoure_template" – explanation follows.

    After saving the Workbook you need to hover over the Datasource-Icon in the "Data" Tab and click on the appearing dropdown-arrow to publish the Datasource.

    It needs to be mentioned, that once a Datasources has been published this way it asks you to update the workbook right afterwards which you must deny in order to be able to edit the Datasources of the workbook afterwards.

    If you need to edit the Datasource at a later point be sure to delete the previously published Datasource then edit and re-publish it.

      November 11, 2021 2:24 PM IST
    0
  • Connect to the Tableau Server repository
    1. In Tableau Desktop select Data > Connect to Data, and then select PostgreSQL as the database to connect to. ...
    2. In the PostgreSQL connection dialog box, enter the name or URL for Tableau Server in the Server box. ...
    3. Specify workgroup as the database to connect to.
      January 5, 2022 2:18 PM IST
    0
    1. In Tableau Desktop select Data > Connect to Data, and then select PostgreSQL as the database to connect to.

      Note: You might need to install the PostgreSQL database drivers. You can download drivers from www.tableau.com/support/drivers class="sr-only">(Link opens in a new window).

    2. In the PostgreSQL connection dialog box, enter the name or URL for Tableau Server in the Server box. If you have a distributed server installation, enter the name or IP address of the node where the repository is hosted.

      Connect using the port you have set up for the pgsql.port, which is 8060 by default.

    3. Specify workgroup as the database to connect to.

    4. Connect using the user and the password you specified.

    5. Click the Require SSL option if you have configured Tableau Server to use SSL for connecting to the repository. For more information, see Configure Postgres SSL to Allow Direct Connections from Clients.
    6. Click Connect.

    7. Select one or more tables to connect to.

      The tableau user has access to all of the tables that start with an underscore or with hist_. For example, you can connect to _background_tasks and _datasources. The hist_ tables include information about server users that isn't currently presented in the Actions by Specific User view. The readonly user has access to additional tables that can be used to query other information about server usage.

    8. Click Go to Worksheet.

    PostgreSQL Version

    Use the following steps to find the version of PostgreSQL used by Tableau Server:

    1. Log into Tableau Server directly or through a remote connection.
    2. Launch Task Manager.
    3. Click the Details tab.
    4. Right click one of the postgres.exe processes and select Properties to see the version of PostgreSQL installed.
      January 8, 2022 2:38 PM IST
    0
  • If the server is accessible via SSH then you can set up a port forwarding tunnel.

    ssh -L 127.0.0.1:5432:postgres.example.com:5432 tableau.example.com
    

     

    Then in the datasource within Tableau Desktop change the host to 127.0.0.1 from postgres.example.com. If there are SSL errors you may want to add an entry to your /etc/hosts file and not change the hostname.

    sudo echo '127.0.0.1 postgres.example.com' >> /etc/hosts
    
      December 21, 2021 1:57 PM IST
    0