> For the complete documentation index, see [llms.txt](https://docs.warpstream.com/warpstream/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.warpstream.com/warpstream/tableflow/catalogs-and-query-engines/clickhouse.md).

# ClickHouse

To query Tableflow tables with ClickHouse, you'll first need to configure credentials for your object store where you've chosen to store your tables and use the [Iceberg table engine](https://clickhouse.com/docs/engines/table-engines/integrations/iceberg).

#### AWS S3

For testing purposes, you can define credentials inline in the `CREATE TABLE` statement. For production, we recommend using the configuration file to define a "named collection" for your credentials.

```xml
<clickhouse>
    <named_collections>
        <iceberg_conf>
            <url>http://test.s3.amazonaws.com/clickhouse-bucket/</url>
            <access_key_id>test</access_key_id>
            <secret_access_key>test</secret_access_key>
        </iceberg_conf>
    </named_collections>
</clickhouse>
```

Then you can run your `CREATE TABLE` statement against the named collection instead of inline credentials:

```sql
CREATE TABLE iceberg_table ENGINE=IcebergS3(iceberg_conf, filename = '<table_directory>')
```

#### GCS

For connecting to GCS, you'll need to create GCS HMAC credentials and use them in place of the `access_key_id` and `secret_access_key` for GCS.

#### Partition Pruning

To take advantage of partition pruning in ClickHouse, you must set a session variable.

```sql
SET use_iceberg_partition_pruning = 1;
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.warpstream.com/warpstream/tableflow/catalogs-and-query-engines/clickhouse.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
