Skip to main content

2. Connect to ClickHouse

Default OLAP connection and Connect to ClickHouse

Within Rill you can set the default OLAP connection on the project level or the dashboard level. For this course, we will set it up on the project level so all of our dashboards will be based on our ClickHouse table.

tip

You have two option for your ClickHouse server:

  1. Use a local running ClickHouse server
  2. Use ClickHouse Cloud

Depending what you choose, the contents of your connection will change and I recommend looking through our ClickHouse documentation for further information.

Changing the default OLAP engine

Let's navigate to the rill.yaml file and add the following.

compiler: rillv1

title: "Rill and ClickHouse Project"
olap_connector: clickhouse

Once updated, we can create the clickhouse connection by selection +Add Data > ClickHouse and fill in the components on the UI.

clickhouse

tip

You can obtain the credentials from your ClickHouse Cloud account by clicking the Connect button in the left panel.:

clickhouse

"https://<hostname>:<port>?username=<username>&password=<password>&secure=true&skip_verify=true"

Once this is created, a clickhouse.yaml file will appear in the connectors folder.

Example for a locally running ClickHouse server:

host: "localhost"
port: "9000"

or

dsn: "clickhouse://localhost:9000"

You can either add the credentials in plain text or dsn via the yaml file or add the credentials via the CLI.

Please see our documentation to find the DSN for your ClickHouse Cloud instance.

How to pass the credentials to Rill

There are a few way to define the credentials within Rill.

Please create a file called clickhouse.yaml and add the following contents.

type: connector
driver: clickhouse

host: "localhost"
port: "9000"

or

type: connector
driver: clickhouse

dsn: "clickhouse://localhost:9000"

You should now be able to see the contents of your ClickHouse database in the left panel of your UI.

my-rill-project