info@lasmart.biz

april 14, 2025

How to connect to ClickHouse from Apache Superset

Connecting to ClickHouse from Apache Superset 3.1.1

In order to install the ClickHouse driver for Apache Superset when deploying via DOCKER COMPOSE, you simply need to add a requirements-local.txt file to the docker directory (this file is not present by default):

Inside the requirements-local.txt file, add the following line:

After you run the command to deploy the containers using DOCKER COMPOSE, the drivers listed in the file will be installed at one of the installation stages.

The libraries from the requirements-local.txt file are installed when the /superset/docker/docker-bootstrap.sh script is executed:

The file itself is added by mounting the docker directory via the DOCKER COMPOSE file /superset/docker-compose-non-dev.yml:

This means that any changes made to the local docker directory in the project will be available inside the container at /app/docker. This is an internal feature of DOCKER COMPOSE.

Creating a connection to ClickHouse from Apache Superset

To create a connection to ClickHouse, go to the SETTINGS menu (top-right corner) and select DATABASE CONNECTIONS:

A list of all previously created connections will appear. To create a new connection, click the «+ DATABASE» button:

After that, you will be able to find ClickHouse in the list of available drivers for creating a connection:

Next, enter the connection parameters, test the connection, and save your new database connection:

How to force-install a driver in Apache Superset image?

If your image is deployed in a way other than via DOCKER COMPOSE, you can either add a command to install the drivers from the requirements-local.txt file, or pre-install the driver into the image.

To do this, you also need to create a requirements-local.txt file in the docker directory with the following content:

Then, create a DOCKERFILE — for example, name it Dockerfile_CH — and add the following code to it:

Superset Image Building with a Custom Dockerfile_CH

Run the image build command:

After the local image has been built, you need to add it as a source for deployment in containers:

For more information, please get in touch here:

Contact Form main