> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-home-button.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Tableau can use ClickHouse databases and tables as a data source.

# Connecting Tableau to ClickHouse

export const ClickHouseSupportedBadge = () => {
  return <div className="ClickHouseSupportedBadge">
            <div className="ClickHouseSupportedIcon">
                <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M1.30762 1.39073C1.30762 1.3103 1.37465 1.22986 1.46849 1.22986H2.64824C2.72868 1.22986 2.80912 1.29689 2.80912 1.39073V14.4886C2.80912 14.5691 2.74209 14.6495 2.64824 14.6495H1.46849C1.38805 14.6495 1.30762 14.5825 1.30762 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M4.2832 1.39073C4.2832 1.3103 4.35023 1.22986 4.44408 1.22986H5.62383C5.70427 1.22986 5.7847 1.29689 5.7847 1.39073V14.4886C5.7847 14.5691 5.71767 14.6495 5.62383 14.6495H4.44408C4.36364 14.6495 4.2832 14.5825 4.2832 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M7.25977 1.39073C7.25977 1.3103 7.3268 1.22986 7.42064 1.22986H8.60039C8.68083 1.22986 8.76127 1.29689 8.76127 1.39073V14.4886C8.76127 14.5691 8.69423 14.6495 8.60039 14.6495H7.42064C7.3402 14.6495 7.25977 14.5825 7.25977 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M10.2354 1.39073C10.2354 1.3103 10.3024 1.22986 10.3962 1.22986H11.576C11.6564 1.22986 11.7369 1.29689 11.7369 1.39073V14.4886C11.7369 14.5691 11.6698 14.6495 11.576 14.6495H10.3962C10.3158 14.6495 10.2354 14.5825 10.2354 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M13.2256 6.6057C13.2256 6.52526 13.2926 6.44482 13.3865 6.44482H14.5662C14.6466 6.44482 14.7271 6.51186 14.7271 6.6057V9.27354C14.7271 9.35398 14.6601 9.43442 14.5662 9.43442H13.3865C13.306 9.43442 13.2256 9.36739 13.2256 9.27354V6.6057Z" fill="currentColor" />
                </svg>
            </div>
            ClickHouse Supported
        </div>;
};

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

ClickHouse offers an official Tableau Connector, featured on
the [Tableau Exchange](https://exchange.tableau.com/products/1064).
The connector is based on ClickHouse's advanced [JDBC driver](/integrations/language-clients/java/jdbc).

With this connector, Tableau integrates ClickHouse databases and tables as data sources. To enable this functionality,
follow the setup guide below.

<h2 id="setup-required-prior-usage">
  Setup required prior usage
</h2>

1. Gather your connection details

   To connect to ClickHouse with HTTP(S) you need this information:

   | Parameter(s)                                                                                 | Description                                                                                                    |
   | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
   | `HOST` and `PORT`                                                                            | Typically, the port is 8443 when using TLS or 8123 when not using TLS.                                         |
   | `DATABASE NAME`                                                                              | Out of the box, there is a database named `default`, use the name of the database that you want to connect to. |
   | `USERNAME` and `PASSWORD`                                                                    | Out of the box, the username is `default`. Use the username appropriate for your use case.                     |
   | The details for your ClickHouse Cloud service are available in the ClickHouse Cloud console. |                                                                                                                |
   | Select a service and click **Connect**:                                                      |                                                                                                                |

   <Image img="https://mintcdn.com/private-7c7dfe99-home-button/kULrYc6Yc_Td1RKY/images/_snippets/cloud-connect-button.png?fit=max&auto=format&n=kULrYc6Yc_Td1RKY&q=85&s=f8f30304147d67b79b22a095be5c28d9" size="md" alt="ClickHouse Cloud service connect button" border width="998" height="932" data-path="images/_snippets/cloud-connect-button.png" />

   Choose **HTTPS**. Connection details are displayed in an example `curl` command.

   <Image img="https://mintcdn.com/private-7c7dfe99-home-button/kULrYc6Yc_Td1RKY/images/_snippets/connection-details-https.png?fit=max&auto=format&n=kULrYc6Yc_Td1RKY&q=85&s=e0ad7ca41bc3d183bee88082e548cd76" size="md" alt="ClickHouse Cloud HTTPS connection details" border width="1320" height="1184" data-path="images/_snippets/connection-details-https.png" />

   If you're using self-managed ClickHouse, the connection details are set by your ClickHouse administrator.

2. Download and install  <a href="https://www.tableau.com/products/desktop/download" target="_blank">Tableau
   desktop</a>.

3. Follow `clickhouse-tableau-connector-jdbc` instructions to download the compatible version
   of <a href="https://github.com/ClickHouse/clickhouse-java/releases/" target="_blank">ClickHouse JDBC driver</a>.

<Note>
  Make sure you download the [clickhouse-jdbc-X.X.X-all-dependencies.jar](https://github.com/ClickHouse/clickhouse-java/releases) JAR file. This artifact is available from version `0.9.2`.
</Note>

4. Store the JDBC driver in the following folder (based on your OS, if the folder doesn't exist, you can create it):
   * macOS: `~/Library/Tableau/Drivers`
   * Windows: `C:\Program Files\Tableau\Drivers`
5. Configure a ClickHouse data source in Tableau and start building data visualizations!

<h2 id="configure-a-clickhouse-data-source-in-tableau">
  Configure a ClickHouse data source in Tableau
</h2>

Now that you have the `clickhouse-jdbc` driver installed and set, let's see how to define a data
source in Tableau that connects to the **TPCD** database in ClickHouse.

1. Start Tableau. (If you already had it running, then restart it.)

2. From the left-side menu, click on **More** under the **To a Server** section. Search for **ClickHouse by ClickHouse** in the available connectors list:

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-home-button/8vRlAzTPu3QtBgl8/images/integrations/data-visualization/tableau_connecttoserver.png?fit=max&auto=format&n=8vRlAzTPu3QtBgl8&q=85&s=e788b10d145ad101e7e36198b755ab07" alt="Tableau connection screen showing the connector selection menu with ClickHouse by ClickHouse option highlighted" border width="980" height="697" data-path="images/integrations/data-visualization/tableau_connecttoserver.png" />

<br />

<Note>
  Don't see the **ClickHouse by ClickHouse** connector in your connectors list? It might be related to an old Tableau Desktop version.
  To solve that, consider upgrading your Tableau Desktop application, or [install the connector manually](#install-the-connector-manually).
</Note>

3. Click on **ClickHouse by ClickHouse**  and the following dialog will pop up:

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-home-button/8vRlAzTPu3QtBgl8/images/integrations/data-visualization/tableau_connector_details.png?fit=max&auto=format&n=8vRlAzTPu3QtBgl8&q=85&s=d35a9cac721d8764e969b7277c1dfa0f" alt="Tableau connector installation dialog showing ClickHouse JDBC connector details and install button" border width="746" height="636" data-path="images/integrations/data-visualization/tableau_connector_details.png" />

<br />

4. Click **Install and Restart Tableau**. Restart the application.
5. After restarting, the connector will have its full name: `ClickHouse JDBC by ClickHouse, Inc.`. When clicking it, the following dialog will pop up:

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-home-button/8vRlAzTPu3QtBgl8/images/integrations/data-visualization/tableau_connector_dialog.png?fit=max&auto=format&n=8vRlAzTPu3QtBgl8&q=85&s=fd3be3bb7d81242a9918b085bdb385ea" alt="ClickHouse connection dialog in Tableau showing fields for server, port, database, username and password" border width="621" height="552" data-path="images/integrations/data-visualization/tableau_connector_dialog.png" />

<br />

6. Enter your connection details:

   | Setting  | Value                                                 |
   | -------- | ----------------------------------------------------- |
   | Server   | **Your ClickHouse host (with no prefixes or suffix)** |
   | Port     | **8443**                                              |
   | Database | **default**                                           |
   | Username | **default**                                           |
   | Password | *\**\*\*\*                                            |

<Note>
  When working with ClickHouse cloud, it's required to enable the SSL checkbox for secured connections.
</Note>

<br />

<Note>
  Our ClickHouse database is named **TPCD**, but you must set the **Database** to **default** in the dialog above, then
  select **TPCD** for the **Schema** in the next step. (This is likely due to a bug in the connector, so this behavior
  could change, but for now you must use **default** as the database.)
</Note>

7. Click the **Sign In** button and you should see a new Tableau workbook:

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-home-button/xFi5J5CWUtR4wSvl/images/integrations/data-visualization/tableau_newworkbook.png?fit=max&auto=format&n=xFi5J5CWUtR4wSvl&q=85&s=2294033587dac4d500bc2ecc52b97892" alt="New Tableau workbook showing the initial connection screen with database selection options" border width="837" height="360" data-path="images/integrations/data-visualization/tableau_newworkbook.png" />

<br />

8. Select **TPCD** from the **Schema** dropdown and you should see the list of tables in **TPCD**:

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-home-button/xFi5J5CWUtR4wSvl/images/integrations/data-visualization/tableau_tpcdschema.png?fit=max&auto=format&n=xFi5J5CWUtR4wSvl&q=85&s=0162c863c0c0075122188ad9146ae0b3" alt="Tableau schema selection showing TPCD database tables including CUSTOMER, LINEITEM, NATION, ORDERS, and others" border width="708" height="491" data-path="images/integrations/data-visualization/tableau_tpcdschema.png" />

<br />

You're now ready to build some visualizations in Tableau!

<h2 id="building-visualizations-in-tableau">
  Building Visualizations in Tableau
</h2>

Now that we have a ClickHouse data source configured in Tableau, let's visualize the data...

1. Drag the **CUSTOMER** table onto the workbook. Notice the columns appear, but the data table is empty:

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-home-button/xFi5J5CWUtR4wSvl/images/integrations/data-visualization/tableau_workbook1.png?fit=max&auto=format&n=xFi5J5CWUtR4wSvl&q=85&s=99cc51054fe681db9499733f2f57b581" alt="Tableau workbook with CUSTOMER table dragged to canvas showing column headers but no data" border width="959" height="626" data-path="images/integrations/data-visualization/tableau_workbook1.png" />

<br />

2. Click the **Update Now** button and 100 rows from **CUSTOMER** will populate the table.

3. Drag the **ORDERS** table into the workbook, then set **Custkey** as the relationship field between the two tables:

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-home-button/xFi5J5CWUtR4wSvl/images/integrations/data-visualization/tableau_workbook2.png?fit=max&auto=format&n=xFi5J5CWUtR4wSvl&q=85&s=63af1f020c7a0f5ef1e26e30957ef322" alt="Tableau relationship editor showing connection between CUSTOMER and ORDERS tables using Custkey field" border width="885" height="644" data-path="images/integrations/data-visualization/tableau_workbook2.png" />

<br />

4. You now have the **ORDERS** and **LINEITEM** tables associated with each other as your data source, so you can use
   this relationship to answer questions about the data. Select the **Sheet 1** tab at the bottom of the workbook.

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-home-button/xFi5J5CWUtR4wSvl/images/integrations/data-visualization/tableau_workbook3.png?fit=max&auto=format&n=xFi5J5CWUtR4wSvl&q=85&s=072bb286762f960bf3e847121771c96b" alt="Tableau worksheet showing the dimensions and measures from ClickHouse tables available for analysis" border width="1151" height="723" data-path="images/integrations/data-visualization/tableau_workbook3.png" />

<br />

5. Suppose you want to know how many specific items were ordered each year. Drag **OrderDate** from **ORDERS** into the
   **Columns** section (the horizontal field), then drag **Quantity** from **LINEITEM** into the **Rows**. Tableau will
   generate the following line chart:

<Image size="sm" img="https://mintcdn.com/private-7c7dfe99-home-button/xFi5J5CWUtR4wSvl/images/integrations/data-visualization/tableau_workbook4.png?fit=max&auto=format&n=xFi5J5CWUtR4wSvl&q=85&s=7771efa0e27d385575e4c75e1910fcc0" alt="Tableau line chart showing quantity ordered by year from ClickHouse data" border width="541" height="526" data-path="images/integrations/data-visualization/tableau_workbook4.png" />

<br />

Not a very exciting line chart, but the dataset was generated by a script and built for testing query performance, so
you will notice there isn't a lot of variations in the simulated orders of the TCPD data.

6. Suppose you want to know the average order amount (in dollars) by quarter and also by shipping mode (air, mail, ship,
   truck, etc.):

   * Click the **New Worksheet** tab create a new sheet
   * Drag **OrderDate** from **ORDERS** into **Columns** and change it from **Year** to **Quarter**
   * Drag **Shipmode** from **LINEITEM** into **Rows**

You should see the following:

<Image size="sm" img="https://mintcdn.com/private-7c7dfe99-home-button/xFi5J5CWUtR4wSvl/images/integrations/data-visualization/tableau_workbook5.png?fit=max&auto=format&n=xFi5J5CWUtR4wSvl&q=85&s=286f4de8be352f5414257ff0c8777572" alt="Tableau crosstab view with quarters as columns and shipment modes as rows" border width="368" height="313" data-path="images/integrations/data-visualization/tableau_workbook5.png" />

<br />

7. The **Abc** values are just filling in the space until you drag a metric onto the table. Drag **Totalprice** from \*
   *ORDERS*\* onto the table. Notice the default calculation is to **SUM** the **Totalprices**:

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-home-button/xFi5J5CWUtR4wSvl/images/integrations/data-visualization/tableau_workbook6.png?fit=max&auto=format&n=xFi5J5CWUtR4wSvl&q=85&s=6f2e3e7c596df30246d748739ba81a37" alt="Tableau crosstab showing sum of total price by quarter and shipment mode" border width="665" height="383" data-path="images/integrations/data-visualization/tableau_workbook6.png" />

<br />

8. Click on **SUM** and change the **Measure** to **Average**. From the same dropdown menu, select **Format** change the
   **Numbers** to **Currency (Standard)**:

<Image size="md" img="https://mintcdn.com/private-7c7dfe99-home-button/xFi5J5CWUtR4wSvl/images/integrations/data-visualization/tableau_workbook7.png?fit=max&auto=format&n=xFi5J5CWUtR4wSvl&q=85&s=36a2d6dedad80b1ebe87f360527ea6b3" alt="Tableau crosstab showing average order price by quarter and shipment mode with currency formatting" border width="804" height="379" data-path="images/integrations/data-visualization/tableau_workbook7.png" />

<br />

Well done! You have successfully connected Tableau to ClickHouse, and you have opened up a whole world of possibilities
for analyzing and visualizing your ClickHouse data.

<h2 id="install-the-connector-manually">
  Install the connector manually
</h2>

In case you use an outdated Tableau Desktop version that doesn't include the connector by default, you can install it manually by following these steps:

1. Download the latest taco file from [Tableau Exchange](https://exchange.tableau.com/products/1064)
2. Place the taco file in
   * macOS: `~/Documents/My Tableau Repository/Connectors`
   * Windows: `C:\Users\[Windows User]\Documents\My Tableau Repository\Connectors`
3. Restart Tableau Desktop, if your setup went successfully, you will set the connector under the `New Data Source` section.

<h2 id="connection-and-analysis-tips">
  Connection and analysis tips
</h2>

For more guidance on optimizing your Tableau-ClickHouse integration,
please visit [Connection Tips](/integrations/connectors/data-visualization/tableau/tableau-connection-tips) and [Analysis Tips](/integrations/connectors/data-visualization/tableau/tableau-analysis-tips).

<h2 id="tests">
  Tests
</h2>

The connector is being tested with the [TDVT framework](https://tableau.github.io/connector-plugin-sdk/docs/tdvt) and currently maintains a 97% coverage ratio.

<h2 id="summary">
  Summary
</h2>

You can connect Tableau to ClickHouse using the generic ODBC/JDBC ClickHouse driver. However, this
connector streamlines the connection setup process. If you have any issues with the connector, feel free to reach out
on <a href="https://github.com/ClickHouse/clickhouse-tableau-connector-jdbc/issues" target="_blank">GitHub</a>.
