# 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
