Tip
If you already have a ClickHouse instance running, skip the steps to set up and clean up ClickHouse.
-
Start a ClickHouse instance:
docker run -d --rm --name some-clickhouse-server -p 8123:8123 -e CLICKHOUSE_USER=user -e CLICKHOUSE_PASSWORD=pass clickhouse/clickhouse-server
-
Install the ClickHouse ADBC driver:
dbc install clickhouse --pre
-
Customize the Python script
main.pyas needed- Change the connection arguments in
db_kwargs- Format
uriaccording to the ClickHouse HTTP interface, or keep it as is
- Format
- If you changed which database you're connecting to, also change the SQL SELECT statement in
cursor.execute()
- Change the connection arguments in
-
Run the Python script:
uv run main.py
Stop the Docker container running ClickHouse:
docker stop some-clickhouse-server