Files
genai-toolbox/tests
Pete Hampton 75a04a55dd feat(clickhouse): Add ClickHouse Source and Tools (#1088)
This PR introduces ClickHouse support by finishing off
https://github.com/googleapis/genai-toolbox/pull/713. We have had quite
a few requests internally and externally of people who want ClickHouse
support and wish to contribute but can't use the toolbox because of this
stalled PR. We also tried to reach out to @sidpan1 ourselves with no
success so we are going to assume the contributor doesn't have time to
complete. We would like to thank @sidpan1 for getting this going -
community contributions help make ClickHouse better for everyone.

This PR introduces

- Adds ClickHouse HTTPS and HTTP source support (drops native support
and compression in connection)
- Adds tools: `execute_sql`, ~~`describe_table`, `list_databases`,
`list_tables`~~
  - Adds unit and integration tests
  - Adds docs

Other contributors can build on this foundation

### Connect to local ClickHouse

```sh
CLICKHOUSE_HOST="localhost" \
  CLICKHOUSE_PORT=8123 \
  CLICKHOUSE_USER="default" \
  CLICKHOUSE_PASSWORD="" \
  CLICKHOUSE_DATABASE=default \
  CLICKHOUSE_PROTOCOL="http" \
  go run main.go --prebuilt clickhouse --ui --port 8080
```

### Connect to ClickHouse Cloud

```sh
CLICKHOUSE_HOST="tsmtweovmw.us-east-2.aws.clickhouse.cloud" \
  CLICKHOUSE_PORT=8443 \
  CLICKHOUSE_USER="default" \
  CLICKHOUSE_PASSWORD="[REDACTED]" \
  CLICKHOUSE_DATABASE=default \
  CLICKHOUSE_PROTOCOL=https \
  go run main.go --prebuilt clickhouse --ui --port 8080
```

### Run tests

```bash
go test -v ./tests/clickhouse/ -run TestClickHouse
go test -v ./tests/clickhouse/ -run TestClickHouseBasicConnection
```

<img width="1318" height="895" alt="Screenshot 2025-08-06 at 10 01 01"
src="https://github.com/user-attachments/assets/034d8f1b-10d6-4097-8033-5b0da93ad3fc"
/>

---------

Co-authored-by: Pete Hampton <pjhampton@users.noreply.github.com>
Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com>
Co-authored-by: duwenxin <duwenxin@google.com>
2025-08-27 18:42:10 -04:00
..
2025-07-16 17:18:24 +05:30