> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/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.

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

export const CommunityMaintainedBadge = () => {
  return <div className="CommunityMaintainedBadge">
            <div className="CommunityMaintainedIcon">
            <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 256 256">
                <path d="M244.8,150.4a8,8,0,0,1-11.2-1.6A51.6,51.6,0,0,0,192,128a8,8,0,0,1-7.37-4.89,8,8,0,0,1,0-6.22A8,8,0,0,1,192,112a24,24,0,1,0-23.24-30,8,8,0,1,1-15.5-4A40,40,0,1,1,219,117.51a67.94,67.94,0,0,1,27.43,21.68A8,8,0,0,1,244.8,150.4ZM190.92,212a8,8,0,1,1-13.84,8,57,57,0,0,0-98.16,0,8,8,0,1,1-13.84-8,72.06,72.06,0,0,1,33.74-29.92,48,48,0,1,1,58.36,0A72.06,72.06,0,0,1,190.92,212ZM128,176a32,32,0,1,0-32-32A32,32,0,0,0,128,176ZM72,120a8,8,0,0,0-8-8A24,24,0,1,1,87.24,82a8,8,0,1,0,15.5-4A40,40,0,1,0,37,117.51,67.94,67.94,0,0,0,9.6,139.19a8,8,0,1,0,12.8,9.61A51.6,51.6,0,0,1,64,128,8,8,0,0,0,72,120Z"></path>
            </svg>
        </div>
            Community Maintained
        </div>;
};

[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.

<h2 id="goal">
  Goal
</h2>

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:

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/5u7Mhe0xzzPTUaXM/images/integrations/data-visualization/chartbrew_01.png?fit=max&auto=format&n=5u7Mhe0xzzPTUaXM&q=85&s=6b8b2a0d20d0ca2435d7256549965fb9" size="lg" alt="Chartbrew dashboard" width="2400" height="1289" data-path="images/integrations/data-visualization/chartbrew_01.png" />

<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](/get-started/sample-datasets/uk-price-paid) dataset.
</Tip>

<h2 id="1-gather-your-connection-details">
  1. Gather your connection details
</h2>

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-mintlify-fbfa8bee/Qke-GQkmVyWEhvPu/images/_snippets/cloud-connect-button.png?fit=max&auto=format&n=Qke-GQkmVyWEhvPu&q=85&s=a41d53ce6c46ccccb2855331a8dcc841" 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-mintlify-fbfa8bee/Qke-GQkmVyWEhvPu/images/_snippets/connection-details-https.png?fit=max&auto=format&n=Qke-GQkmVyWEhvPu&q=85&s=0377c34215bd524b359c0d20dd96bed3" 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.

<h2 id="2-connect-chartbrew-to-clickhouse">
  2. Connect Chartbrew to ClickHouse
</h2>

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.

   <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/5u7Mhe0xzzPTUaXM/images/integrations/data-visualization/chartbrew_02.png?fit=max&auto=format&n=5u7Mhe0xzzPTUaXM&q=85&s=bfb6d0835e2e87b915a1522fcf9b3259" size="lg" alt="Select ClickHouse connection in Chartbrew" width="1600" height="1132" data-path="images/integrations/data-visualization/chartbrew_02.png" />

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.

   <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/5u7Mhe0xzzPTUaXM/images/integrations/data-visualization/chartbrew_03.png?fit=max&auto=format&n=5u7Mhe0xzzPTUaXM&q=85&s=c66effcdec4a87acae087d355ff51160" size="lg" alt="ClickHouse connection settings in Chartbrew" width="1600" height="1141" data-path="images/integrations/data-visualization/chartbrew_03.png" />

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.

   <Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/5u7Mhe0xzzPTUaXM/images/integrations/data-visualization/chartbrew_04.png?fit=max&auto=format&n=5u7Mhe0xzzPTUaXM&q=85&s=32ae594cd8003f723a34ef7be76e1239" size="lg" alt="ClickHouse JSON schema in Chartbrew" width="1600" height="855" data-path="images/integrations/data-visualization/chartbrew_04.png" />

<h2 id="3-create-a-dataset-and-run-a-sql-query">
  3) Create a dataset and run a SQL query
</h2>

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

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/5u7Mhe0xzzPTUaXM/images/integrations/data-visualization/chartbrew_05.png?fit=max&auto=format&n=5u7Mhe0xzzPTUaXM&q=85&s=d426cdd1a0794813e68db9a9cb0db5c6" size="lg" alt="Select ClickHouse connection for dataset" width="1600" height="725" data-path="images/integrations/data-visualization/chartbrew_05.png" />

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;
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/5u7Mhe0xzzPTUaXM/images/integrations/data-visualization/chartbrew_07.png?fit=max&auto=format&n=5u7Mhe0xzzPTUaXM&q=85&s=ae709f1d2f7584a2d84aff01ec3a3fb3" size="lg" alt="ClickHouse SQL query in Chartbrew" width="1600" height="928" data-path="images/integrations/data-visualization/chartbrew_07.png" />

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.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/5u7Mhe0xzzPTUaXM/images/integrations/data-visualization/chartbrew_06.png?fit=max&auto=format&n=5u7Mhe0xzzPTUaXM&q=85&s=8c4731171ea0085ec34a2756684e4eec" size="lg" alt="ClickHouse AI SQL assistant in Chartbrew" width="2400" height="1184" data-path="images/integrations/data-visualization/chartbrew_06.png" />

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

<h2 id="4-create-a-visualization">
  4. Create a visualization
</h2>

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.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/5u7Mhe0xzzPTUaXM/images/integrations/data-visualization/chartbrew_08.png?fit=max&auto=format&n=5u7Mhe0xzzPTUaXM&q=85&s=9a3e095594662aa77a4d6de2e3f77d47" size="lg" alt="Chartbrew dashboard with ClickHouse data" width="2400" height="1068" data-path="images/integrations/data-visualization/chartbrew_08.png" />

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.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/5u7Mhe0xzzPTUaXM/images/integrations/data-visualization/chartbrew_01.png?fit=max&auto=format&n=5u7Mhe0xzzPTUaXM&q=85&s=6b8b2a0d20d0ca2435d7256549965fb9" size="lg" alt="Chartbrew dashboard with ClickHouse data" width="2400" height="1289" data-path="images/integrations/data-visualization/chartbrew_01.png" />

<h2 id="5-automate-data-updates">
  5. Automate data updates
</h2>

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.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-fbfa8bee/5u7Mhe0xzzPTUaXM/images/integrations/data-visualization/chartbrew_09.png?fit=max&auto=format&n=5u7Mhe0xzzPTUaXM&q=85&s=851aa4f6d193836907e28ee1a74345d2" size="lg" alt="Chartbrew dataset refresh settings" width="1600" height="899" data-path="images/integrations/data-visualization/chartbrew_09.png" />

<h2 id="learn-more">
  Learn more
</h2>

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/).
