Federation to ClickHouse setup guide
Connect your ClickHouse to Propel for Federation.
This guide explains how to connect your own ClickHouse to Propel. It works with self-hosted, managed, or ClickHouse Cloud servers.
It covers how to:
- Create a user for Propel in your ClickHouse server.
- Make sure your ClickHouse is accessible from Propel IPs.
- Create a ClickHouse Data Pool in Propel.
- Preview and query your data.
Requirements
- You have a Propel account.
- You have a ClickHouse Cloud, self-managed, or managed ClickHouse server.
- A user with
SELECT
permission on the tables you need to connect.
Step 1: Create a user for Propel in your ClickHouse server
In this section, you’ll set up a user for Propel. Propel will use this user to connect to your ClickHouse instance and query the tables.
Create the role 'propel_role'
To create a role for Propel in ClickHouse, execute the SQL statement below.
Grant necessary permissions
Propel needs to be able to do a SELECT
on the tables. You need to grant the “propel_role” role SELECT
privileges. You can limit this grant to only the tables you are going to connect to Propel by specifying each table name instead of the ”*”.
Replace <DATABASE_NAME>
with your database name.
Create and assign the user
Create the user “propel_user” and assign it the role “propel_role”. You can do this with the following SQL statements:
Make sure to replace <REPLACE_PASSWORD>
with a secure password.
Test the user
To ensure your user has the necessary permissions to see and query the tables you need, connect to your ClickHouse using the “propel_user” you just created and run the following statements:
Make sure to replace <DATABASE_NAME>
with a secure password. You should see the tables you need to connect to Propel.
Make sure you can query the tables using a SELECT
SQL statement.
If you see the records, you are good to go!
Step 2. Make sure your ClickHouse is accessible from Propel IPs
To ensure that Propel can connect to your ClickHouse server, you need to authorize access from the following IP addresses:
2.1 Allowing Propel’s IP in ClickHouse Cloud
If you are using ClickHouse Cloud, go to “Settings” then “IP access list” and click “Add IPs”.
Add the Propel IPs to the list.
Step 3: Create a ClickHouse Data Pool in Propel
Go to Data Pools
A Propel Data Pool will represent a table in your ClickHouse server.
Go to the “Data Pools” section of the Console and click “Create Data Pool”.
Select ClickHouse
In the new Data Pool page, select “ClickHouse”.
Add credentials
Select “Add Credentials”.
Enter your ClickHouse connection details and click “Test Credentials”.
Wait until Propel connects and runs all the tests, then click “Next”.
Select tables
Check that Propel has access to all the tables you need, and click “Continue” to finish setting up your first ClickHouse Data Pool.
Select the table and columns you want to connect to Propel and click “Next”.
Configure timestamp
Select the primary timestamp of the table and click “Next”.
Name your Data Pool
Give your Data Pool a name and a description, and click “Create Data Pool”.
You should see the setup tasks completed successfully, and then you’re all done!
Step 4: Preview and query your data
Preview your data
Click on the “Preview Data” tab.
Query with SQL
Click the “Playground” section and select “SQL” from the API dropdown.
Query with GraphQL
Click the “Playground” section and select “GraphQL” from the API dropdown.
Was this page helpful?