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

# ClickHouse

> Connect Summation to ClickHouse, including ClickHouse Cloud.

Summation connects to ClickHouse using either a **connection string** or discrete host/port fields. The form has both — fill in whichever is more convenient. If you fill in the connection string, the discrete fields below it are ignored.

## What you'll need

* A reachable ClickHouse server. For ClickHouse Cloud, find connection details under **Connect** in your service overview. See [SQL console](https://clickhouse.com/docs/cloud/get-started/sql-console) and the [Cloud overview](https://clickhouse.com/docs/cloud/overview).
* A user with `SELECT` on the tables you want exposed. See [Access control and account management](https://clickhouse.com/docs/operations/access-rights).

## Form fields

| Field                       | Required                      | Stored as | Notes                                                                                                                                                                               |
| --------------------------- | ----------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Connection String**       | Optional                      | Config    | DSN of the form `tcp://user:${secrets:my_pass}@host:9000/db`. Overrides the discrete fields when set. See the [Native TCP protocol](https://clickhouse.com/docs/en/interfaces/tcp). |
| **Host**                    | Yes (if no connection string) | Config    | DNS name or IP.                                                                                                                                                                     |
| **TCP Port**                | Yes (if no connection string) | Config    | Default `9000`. ClickHouse Cloud uses `9440` (secure native) or `8443` (HTTPS).                                                                                                     |
| **Database**                | Yes                           | Config    | Default ClickHouse database, e.g. `default`.                                                                                                                                        |
| **Username**                | Yes                           | Config    | ClickHouse user.                                                                                                                                                                    |
| **Password**                | Yes                           | Secret    |                                                                                                                                                                                     |
| **Secure**                  | Yes                           | Config    | `true` for TLS, `false` for plaintext. Default `true`. ClickHouse Cloud requires `true`.                                                                                            |
| **Connection Timeout (ms)** | Yes                           | Config    | How long to wait when establishing a connection. Default `10000` (10s).                                                                                                             |

## Setup SQL

```sql theme={null}
CREATE USER summation IDENTIFIED WITH sha256_password BY '<strong-password>';
GRANT SELECT ON analytics.* TO summation;
```

See [CREATE USER](https://clickhouse.com/docs/sql-reference/statements/create/user) and [GRANT](https://clickhouse.com/docs/sql-reference/statements/grant) in the ClickHouse docs for more options.

## Adding datasets

Source references use the form:

```
clickhouse:my.dataset
```

## Common problems

| Error or symptom                  | Likely cause                                                                                        |
| --------------------------------- | --------------------------------------------------------------------------------------------------- |
| `Connection refused` on port 9000 | ClickHouse Cloud doesn't expose the native protocol on `9000`. Use `9440` with **Secure** = `true`. |
| TLS handshake failure             | **Secure** doesn't match the server. Cloud always requires TLS; some self-hosted setups don't.      |
| `Authentication failed`           | Confirm the user exists and isn't restricted by `host` or `quota` profiles.                         |
