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

# ClickHouse relation source

> Observe a local ClickHouse MergeTree table through the native HTTPS query interface.

Mount [the SQL app](https://docs.bijection.com/integrations/native-sql.md#mount-and-bind) once per table.
Bind `clickHouseRelation("https://warehouse.example:8443", login, data)`
to the SQL app's `provider`. Pass the same label to the receiver binder and as the app's `data`. The app commits each page's observations and position
together at that label.

Seal the following JSON as the receiver credential with `bijection secret set`.
Use a login with read access to the declared table and visibility of its
`system.tables` and `system.columns` metadata. The profile sends fixed SELECT
statements over a verified HTTPS origin. The server must accept multipart
query parameters and the per-request `max_execution_time`,
`timeout_overflow_mode`, `read_overflow_mode` and `result_overflow_mode`
settings. Configure the account for SELECT-only access with permission to set
those bounded query options.

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "username": "inventory_reader",
  "password": "<ClickHouse password>",
  "database": "publishing",
  "table": "items",
  "key": [{"column": "region", "kind": "text"}, {"column": "id", "kind": "bigint"}],
  "columns": ["region", "id", "description"],
  "incarnation": "inventory-items-1"
}
```

Use a local `MergeTree` table with a nonzero UUID and plain stored columns.
Maintain a unique, non-null tuple of one to eight `Int64` or UTF-8 `String`
columns. ClickHouse's primary index permits duplicates, so source owners must
maintain this uniqueness. The app compares the full tuple in numeric and
UTF-8 byte order. It keeps record keys as JSON arrays of strings, with a
512-byte encoded key limit. Project one to sixteen columns from `String`,
`Bool`, or the 8-, 16-, 32- and 64-bit signed and unsigned integer types.
Projected values land as JSON strings or null.

Each page observes the statement's table view and publishes up to 32 rows.
A page has a 48 KiB encoded answer limit and a 24 KiB payload limit per row.
When the next row exceeds the payload or encoded answer limit, the position
stays before that row. A traversal can span concurrent writes. It refreshes seen
keys and keeps keys that disappear. This profile provides no CDC.

The driver compares the table UUID and selected column metadata before and
after the statement. A detected change stops the source. Change the configured
incarnation when replacing or restoring the table, including when a restore
preserves the UUID. Authorize a reset at the health revision and gap stamp.

[ClickHouse HTTPS interface](https://clickhouse.com/docs/interfaces/http)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.