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

> Luzmo is an embedded analytics platform with a native ClickHouse integration, purpose-built for Software and SaaS applications.

# Integrating Luzmo with ClickHouse

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

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

<Steps>
  <Step title="Setup a ClickHouse connection" id="1-setup-a-clickhouse-connection">
    To make a connection to ClickHouse, navigate to the **Connections page**, select **New Connection**, then select the ClickHouse from the New Connection modal.

    <Image img="https://mintcdn.com/private-7c7dfe99-postgresql-tls-support/sK1EDai1DhVYGATV/images/integrations/data-visualization/luzmo_01.webp?fit=max&auto=format&n=sK1EDai1DhVYGATV&q=85&s=d9c0065c963579293cfc4c77f1bb408b" size="md" alt="Luzmo interface showing the Create a New Connection dialog with ClickHouse selected" border width="720" height="497" data-path="images/integrations/data-visualization/luzmo_01.webp" />

    You'll be asked to provide a **host**, **username** and **password**:

    <Image img="https://mintcdn.com/private-7c7dfe99-postgresql-tls-support/sK1EDai1DhVYGATV/images/integrations/data-visualization/luzmo_02.webp?fit=max&auto=format&n=sK1EDai1DhVYGATV&q=85&s=d488656bf75fddff786e0cdf5e42530d" size="md" alt="Luzmo connection configuration form showing fields for ClickHouse host, username and password" border width="462" height="454" data-path="images/integrations/data-visualization/luzmo_02.webp" />

    * **Host**: this is the host where your ClickHouse database is exposed. Note that only `https` is allowed here in order to securely transfer data over the wire. The structure of the host url expects: `https://url-to-clickhouse-db:port/database`
      By default, the plugin will connect to the 'default' database and the 443 port. By providing a database after the '/' you can configure which database to connect to.
    * **Username**: the username that will be used to connect to your ClickHouse cluster.
    * **Password**: the password to connect to your ClickHouse cluster

    Please refer to the examples in our developer documentation to find out how to [create a connection to ClickHouse](https://developer.luzmo.com/api/createAccount?exampleSection=AccountCreateClickhouseRequestBody) via our API.
  </Step>

  <Step title="Add datasets" id="2-add-datasets">
    Once you have connected your ClickHouse you can add datasets as explained [here](https://academy.luzmo.com/article/ldx3iltg). You can select one or multiple datasets as available in your ClickHouse and [link](https://academy.luzmo.com/article/gkrx48x5) them in Luzmo to ensure they can be used together in a dashboard. Also make sure to check out this article on [Preparing your data for analytics](https://academy.luzmo.com/article/u492qov0).

    To find out how to add datasets using our API, please refer to [this example in our developer documentation](https://developer.luzmo.com/api/createDataprovider?exampleSection=DataproviderCreateClickhouseRequestBody).

    You can now use your datasets to build beautiful (embedded) dashboards, or even power an AI Data Analyst ([Luzmo IQ](https://luzmo.com/iq)) that can answer your clients' questions.

    <Image img="https://mintcdn.com/private-7c7dfe99-postgresql-tls-support/sK1EDai1DhVYGATV/images/integrations/data-visualization/luzmo_03.webp?fit=max&auto=format&n=sK1EDai1DhVYGATV&q=85&s=55958b42e52116142c42433a2d221b69" size="md" alt="Luzmo dashboard example showing multiple visualizations of data from ClickHouse" border width="956" height="693" data-path="images/integrations/data-visualization/luzmo_03.webp" />
  </Step>
</Steps>

<h2 id="usage-notes">
  Usage notes
</h2>

1. The Luzmo ClickHouse connector uses the HTTP API interface (typically running on port 8123) to connect.
2. If you use tables with the `Distributed` table engine some Luzmo-charts might fail when `distributed_product_mode` is `deny`. This should only occur, however, if you link the table to another table and use that link in a chart. In that case make sure to set the `distributed_product_mode` to another option that makes sense for you within your ClickHouse cluster. If you're using ClickHouse Cloud you can safely ignore this setting.
3. To ensure that e.g. only the Luzmo application can access your ClickHouse instance, it is highly recommended to **whitelist** the [Luzmo range of static IP addresses](https://academy.luzmo.com/article/u9on8gbm). We also recommend using a technical read-only user.
4. The ClickHouse connector currently supports following data types:

   | ClickHouse Type | Luzmo Type |
   | --------------- | ---------- |
   | UInt            | numeric    |
   | Int             | numeric    |
   | Float           | numeric    |
   | Decimal         | numeric    |
   | Date            | datetime   |
   | DateTime        | datetime   |
   | String          | hierarchy  |
   | Enum            | hierarchy  |
   | FixedString     | hierarchy  |
   | UUID            | hierarchy  |
   | Bool            | hierarchy  |
