> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connecting Chartbrew to ClickHouse

> Connect Chartbrew to ClickHouse to create real-time dashboards and client reports.

Community maintained

[Chartbrew](https://chartbrew.com) is a data visualization platform that allows you to create dashboards and monitor data in real time. It supports multiple data sources, including ClickHouse, and provides a no-code interface for building charts and reports.

## Goal

In this guide, you will connect Chartbrew to ClickHouse, run a SQL query, and create a visualization. By the end, your dashboard may look something like this:

![Chartbrew dashboard](https://mintcdn.com/private-7c7dfe99/NPtTt-7kspu8ZZfQ/images/integrations/data-visualization/chartbrew_01.webp?fit=max\&auto=format\&n=NPtTt-7kspu8ZZfQ\&q=85\&s=1349aa713c51f0c9da12e18a3c835291)

> [!TIP]
>
> **Add some data**
>
> If you don't have a dataset to work with, you can add one of the examples. This guide uses the [UK Price Paid](https://clickhouse.com/docs/get-started/sample-datasets/uk-price-paid.md) dataset.

**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**:

![ClickHouse Cloud service connect button](https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/_snippets/cloud-connect-button.webp?fit=max\&auto=format\&n=EDr8ydtGBgFPOQea\&q=85\&s=97d6a020a443f1b365b017488b39d0c8)

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

![ClickHouse Cloud HTTPS connection details](https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/_snippets/connection-details-https.webp?fit=max\&auto=format\&n=EDr8ydtGBgFPOQea\&q=85\&s=80369fc90cd1ac3108fe455f2426c19a)

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

**2. Connect Chartbrew to ClickHouse**

1. Log in to [Chartbrew](https://chartbrew.com/login) and go to the **Connections** tab.

2. Click **Create connection** and select **ClickHouse** from the available database options.

   ![Select ClickHouse connection in Chartbrew](https://mintcdn.com/private-7c7dfe99/NPtTt-7kspu8ZZfQ/images/integrations/data-visualization/chartbrew_02.webp?fit=max\&auto=format\&n=NPtTt-7kspu8ZZfQ\&q=85\&s=bfc0818b3fdf59883e0a5cfcf4d638ba)

3. Enter the connection details for your ClickHouse database:

   * **Display Name**: A name to identify the connection in Chartbrew.
   * **Host**: The hostname or IP address of your ClickHouse server.
   * **Port**: Typically `8443` for HTTPS connections.
   * **Database Name**: The database you want to connect to.
   * **Username**: Your ClickHouse username.
   * **Password**: Your ClickHouse password.

   ![ClickHouse connection settings in Chartbrew](https://mintcdn.com/private-7c7dfe99/NPtTt-7kspu8ZZfQ/images/integrations/data-visualization/chartbrew_03.webp?fit=max\&auto=format\&n=NPtTt-7kspu8ZZfQ\&q=85\&s=69717b4840a4f638a20191c9cd428732)

4. Click **Test connection** to verify that Chartbrew can connect to ClickHouse.

5. If the test is successful, click **Save connection**. Chartbrew will automatically retrieve the schema from ClickHouse.

   ![ClickHouse JSON schema in Chartbrew](https://mintcdn.com/private-7c7dfe99/NPtTt-7kspu8ZZfQ/images/integrations/data-visualization/chartbrew_04.webp?fit=max\&auto=format\&n=NPtTt-7kspu8ZZfQ\&q=85\&s=b1c0ef9050c9b364888b5a137b0b840e)

**3. Create a dataset and run a SQL query**

1. Click on the **Create dataset** button or navigate to the **Datasets** tab to create one.
2. Select the ClickHouse connection you created earlier.

![Select ClickHouse connection for dataset](https://mintcdn.com/private-7c7dfe99/NPtTt-7kspu8ZZfQ/images/integrations/data-visualization/chartbrew_05.webp?fit=max\&auto=format\&n=NPtTt-7kspu8ZZfQ\&q=85\&s=85d2e70ce0b4d57e04c994516e1bba5b)

Write a SQL query to retrieve the data you want to visualize. For example, this query calculates the average price paid per year from the `uk_price_paid` dataset:

```sql theme={null}
SELECT toYear(date) AS year, avg(price) AS avg_price
FROM uk_price_paid
GROUP BY year
ORDER BY year;
```

![ClickHouse SQL query in Chartbrew](https://mintcdn.com/private-7c7dfe99/NPtTt-7kspu8ZZfQ/images/integrations/data-visualization/chartbrew_07.webp?fit=max\&auto=format\&n=NPtTt-7kspu8ZZfQ\&q=85\&s=caa6a8a5d493410b4b7d450e7a0dfc6f)

Click **Run query** to fetch the data.

If you're unsure how to write the query, you can use **Chartbrew's AI assistant** to generate SQL queries based on your database schema.

![ClickHouse AI SQL assistant in Chartbrew](https://mintcdn.com/private-7c7dfe99/NPtTt-7kspu8ZZfQ/images/integrations/data-visualization/chartbrew_06.webp?fit=max\&auto=format\&n=NPtTt-7kspu8ZZfQ\&q=85\&s=5acc3a5f347465548d6ebd8ea3c21cb5)

Once the data is retrieved, click **Configure dataset** to set up the visualization parameters.

**4. Create a visualization**

1. Define a metric (numerical value) and dimension (categorical value) for your visualization.
2. Preview the dataset to ensure the query results are structured correctly.
3. Choose a chart type (e.g., line chart, bar chart, pie chart) and add it to your dashboard.
4. Click **Complete dataset** to finalize the setup.

![Chartbrew dashboard with ClickHouse data](https://mintcdn.com/private-7c7dfe99/NPtTt-7kspu8ZZfQ/images/integrations/data-visualization/chartbrew_08.webp?fit=max\&auto=format\&n=NPtTt-7kspu8ZZfQ\&q=85\&s=6330981cc899aebe8f63b32b09554a69)

You can create as many datasets as you want to visualize different aspects of your data. Using these datasets, you can create multiple dashboards to keep track of different metrics.

![Chartbrew dashboard with ClickHouse data](https://mintcdn.com/private-7c7dfe99/NPtTt-7kspu8ZZfQ/images/integrations/data-visualization/chartbrew_01.webp?fit=max\&auto=format\&n=NPtTt-7kspu8ZZfQ\&q=85\&s=1349aa713c51f0c9da12e18a3c835291)

**5. Automate data updates**

To keep your dashboard up-to-date, you can schedule automatic data updates:

1. Click the Calendar icon next to the dataset refresh button.
2. Configure the update interval (e.g., every hour, every day).
3. Save the settings to enable automatic refresh.

![Chartbrew dataset refresh settings](https://mintcdn.com/private-7c7dfe99/NPtTt-7kspu8ZZfQ/images/integrations/data-visualization/chartbrew_09.webp?fit=max\&auto=format\&n=NPtTt-7kspu8ZZfQ\&q=85\&s=371f4bbe39d96cacc2c442fe2986fcb4)

## Learn more

For more details, check out the blog post about [Chartbrew and ClickHouse](https://chartbrew.com/blog/visualizing-clickhouse-data-with-chartbrew-a-step-by-step-guide/).
