|
| 1 | +--- |
| 2 | +sidebar_label: Chartbrew |
| 3 | +sidebar_position: 131 |
| 4 | +slug: /integrations/chartbrew-and-clickhouse |
| 5 | +keywords: [ClickHouse, Chartbrew, connect, integrate, visualization] |
| 6 | +description: Chartbrew is a data visualization platform that connects to ClickHouse and other databases to build real-time dashboards. |
| 7 | +--- |
| 8 | + |
| 9 | +import ConnectionDetails from '@site/docs/_snippets/_gather_your_details_http.mdx'; |
| 10 | +import chartbrew_01 from '@site/static/images/integrations/data-visualization/chartbrew_01.png'; |
| 11 | +import chartbrew_02 from '@site/static/images/integrations/data-visualization/chartbrew_02.png'; |
| 12 | +import chartbrew_03 from '@site/static/images/integrations/data-visualization/chartbrew_03.png'; |
| 13 | +import chartbrew_04 from '@site/static/images/integrations/data-visualization/chartbrew_04.png'; |
| 14 | +import chartbrew_05 from '@site/static/images/integrations/data-visualization/chartbrew_05.png'; |
| 15 | +import chartbrew_06 from '@site/static/images/integrations/data-visualization/chartbrew_06.png'; |
| 16 | +import chartbrew_07 from '@site/static/images/integrations/data-visualization/chartbrew_07.png'; |
| 17 | +import chartbrew_08 from '@site/static/images/integrations/data-visualization/chartbrew_08.png'; |
| 18 | +import chartbrew_09 from '@site/static/images/integrations/data-visualization/chartbrew_09.png'; |
| 19 | + |
| 20 | +# Connecting Chartbrew to ClickHouse |
| 21 | + |
| 22 | +[Chartbrew](https://chartbrew.com) is a data visualization platform that allows users 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. |
| 23 | + |
| 24 | +## Goal {#goal} |
| 25 | + |
| 26 | +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: |
| 27 | + |
| 28 | +<img src={chartbrew_01} class="image" alt="Chartbrew dashboard" /> |
| 29 | + |
| 30 | +:::tip Add some data |
| 31 | +If you do not have a dataset to work with, you can add one of the examples. This guide uses the [UK Price Paid](/getting-started/example-datasets/uk-price-paid.md) dataset. |
| 32 | +::: |
| 33 | + |
| 34 | +## 1. Gather your connection details {#1-gather-your-connection-details} |
| 35 | + |
| 36 | +<ConnectionDetails /> |
| 37 | + |
| 38 | +## 2. Connect Chartbrew to ClickHouse {#2-connect-chartbrew-to-clickhouse} |
| 39 | + |
| 40 | +1. Log in to [Chartbrew](https://chartbrew.com) and go to the **Connections** tab. |
| 41 | +2. Click **Create connection** and select **ClickHouse** from the available database options. |
| 42 | + |
| 43 | + <img src={chartbrew_02} class="image" alt="Select ClickHouse connection in Chartbrew" /> |
| 44 | + |
| 45 | +3. Enter the connection details for your ClickHouse database: |
| 46 | + |
| 47 | + - **Display Name**: A name to identify the connection in Chartbrew. |
| 48 | + - **Host**: The hostname or IP address of your ClickHouse server. |
| 49 | + - **Port**: Typically `8443` for HTTPS connections. |
| 50 | + - **Database Name**: The database you want to connect to. |
| 51 | + - **Username**: Your ClickHouse username. |
| 52 | + - **Password**: Your ClickHouse password. |
| 53 | + |
| 54 | + <img src={chartbrew_03} class="image" alt="ClickHouse connection settings in Chartbrew" /> |
| 55 | + |
| 56 | +4. Click **Test connection** to verify that Chartbrew can connect to ClickHouse. |
| 57 | +5. If the test is successful, click **Save connection**. Chartbrew will automatically retrieve the schema from ClickHouse. |
| 58 | + |
| 59 | + <img src={chartbrew_04} class="image" alt="ClickHouse JSON schema in Chartbrew" /> |
| 60 | + |
| 61 | +## 3. Create a dataset and run a SQL query {#3-create-a-dataset-and-run-a-sql-query} |
| 62 | + |
| 63 | + 1. Click on the **Create dataset** button or navigate to the **Datasets** tab to create one. |
| 64 | + 2. Select the ClickHouse connection you created earlier. |
| 65 | + |
| 66 | + <img src={chartbrew_05} class="image" alt="Select ClickHouse connection for dataset" /> |
| 67 | + |
| 68 | + 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: |
| 69 | + |
| 70 | + ```sql |
| 71 | + SELECT toYear(date) AS year, avg(price) AS avg_price |
| 72 | + FROM uk_price_paid |
| 73 | + GROUP BY year |
| 74 | + ORDER BY year; |
| 75 | + ``` |
| 76 | + |
| 77 | + <img src={chartbrew_07} class="image" alt="ClickHouse SQL query in Chartbrew" /> |
| 78 | + |
| 79 | + Click **Run query** to fetch the data. |
| 80 | + |
| 81 | + 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. |
| 82 | + |
| 83 | +<img src={chartbrew_06} class="image" alt="ClickHouse AI SQL assistant in Chartbrew" /> |
| 84 | + |
| 85 | +Once the data is retrieved, click **Configure dataset** to set up the visualization parameters. |
| 86 | + |
| 87 | +## 4. Create a visualization {#4-create-a-visualization} |
| 88 | + |
| 89 | + 1. Define a metric (numerical value) and dimension (categorical value) for your visualization. |
| 90 | + 2. Preview the dataset to ensure the query results are structured correctly. |
| 91 | + 3. Choose a chart type (e.g., line chart, bar chart, pie chart) and add it to your dashboard. |
| 92 | + 4. Click **Complete dataset** to finalize the setup. |
| 93 | + |
| 94 | + <img src={chartbrew_08} class="image" alt="Chartbrew dashboard with ClickHouse data" /> |
| 95 | + |
| 96 | + 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. |
| 97 | + |
| 98 | + <img src={chartbrew_01} class="image" alt="Chartbrew dashboard with ClickHouse data" /> |
| 99 | + |
| 100 | +## 5. Automate data updates {#5-automate-data-updates} |
| 101 | + |
| 102 | + To keep your dashboard up-to-date, you can schedule automatic data updates: |
| 103 | + |
| 104 | + 1. Click the Calendar icon next to the dataset refresh button. |
| 105 | + 2. Configure the update interval (e.g., every hour, every day). |
| 106 | + 3. Save the settings to enable automatic refresh. |
| 107 | + |
| 108 | + <img src={chartbrew_09} class="image" alt="Chartbrew dataset refresh settings" /> |
| 109 | + |
| 110 | +## Learn more {#learn-more} |
| 111 | + |
| 112 | +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/). |
0 commit comments