Skip to content

Repository files navigation

ClickHouse ODBC Bridge test environment

This repository provides a local Docker Compose environment for testing ClickHouse access to Microsoft SQL Server 2017 through clickhouse-odbc-bridge.

It starts three services:

  • clickhouse — ClickHouse Server, exposed on 8123 (HTTP) and 9000 (native).
  • odbc-bridge — ClickHouse ODBC bridge with Microsoft ODBC Driver 17.
  • mssql — SQL Server 2017 Developer Edition with a small sample table.

The bridge is a sidecar service. ClickHouse sends ODBC requests to it over the internal Compose network; port 9018 is intentionally not published to the host.

Requirements

  • Docker Engine with Docker Compose v2
  • An amd64 Docker runtime. SQL Server 2017 and Microsoft ODBC Driver 17 in this setup are linux/amd64 only.

Start the environment

Create a local environment file and choose a strong SQL Server password:

cp .env.example .env
docker compose up --build -d

Wait for the mssql-init service to complete successfully:

docker compose ps

Run the smoke test

The initialization service creates testdb.dbo.sample_data. Query it from ClickHouse through the ODBC bridge:

docker compose exec clickhouse sh -c \
  'clickhouse-client --query "SELECT * FROM odbc('\''DSN=mssql2017;UID=$MSSQL_USER;PWD={$MSSQL_PASSWORD}'\'', '\''dbo'\'', '\''sample_data'\'') ORDER BY id"'

Expected result:

1   Ada     125.50  2024-01-15 09:30:00
2   Grace   250.00  2024-02-20 14:45:00
3   Linus   375.25  2024-03-10 08:00:00

Configuration

docker/odbc.ini.template is rendered by the bridge container at startup. Its values come from .env; do not commit .env. The DSN name is mssql2017 to make the target explicit, but it can be renamed along with the query above. The table function receives SQL Server credentials in its ODBC connection string, which is why the smoke test uses variables injected into ClickHouse.

For a different SQL Server version or deployment, adjust the mssql service image and the variables in .env. The final bridge image contains only the bridge binary, its runtime dependencies, unixODBC, and the installed SQL Server driver. The ClickHouse Server image is used only during the multi-stage build and is not present in the final image.

Stop and reset

docker compose down -v

About

A reproducible Docker Compose test lab for ClickHouse ODBC Bridge. Demonstrates ClickHouse connectivity to Microsoft SQL Server 2017 through an isolated ODBC Bridge sidecar with Microsoft ODBC Driver 17.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages