# 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;
```
