> ## Documentation Index
> Fetch the complete documentation index at: https://docs.drdroid.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Clickhouse

> Connecting to Clickhousedb

## Connection:

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/l8CbDnIMqFQ" title="Clickhouse Integration Docs" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

#### Step 1: Go to Integrations > Clickhouse in the Playbooks platform.

<img src="https://mintcdn.com/drdroid-88/7v3BmpsGXj6G8uPu/images/docs/df5837a-image.png?fit=max&auto=format&n=7v3BmpsGXj6G8uPu&q=85&s=a975b9e81eb8109109249a2efc7dc17b" alt="" width="960" height="452" data-path="images/docs/df5837a-image.png" />

#### Step 2: Enter your database connection details. (database host, port, and credentials (username and password))

<img src="https://mintcdn.com/drdroid-88/1SAc3s_qYs-82p4P/images/docs/f9abc4b-image.png?fit=max&auto=format&n=1SAc3s_qYs-82p4P&q=85&s=0c7e7b71791c399cc015de8ba05c1e5a" alt="" width="1920" height="984" data-path="images/docs/f9abc4b-image.png" />

> Note: When you fill in the host, you **do not need to add https\://**.

#### Step 3: **Testing the Integration**: Create a playbook that includes a step to run a simple SELECT query against your Clickhouse database and verify the results are fetched correctly.

## Querying:

After adding Clickhouse DB as a connection, you can do the following:

* Run a query on Clickhouse DB.

### How to limit access to select tables/DBs within Playbooks?

To restrict permissions to the users accessing Clickhouse via Playbooks, we recommend using roles that are relevant for

#### Create a new user:

<CodeGroup>
  ```bash bash theme={null}
  CREATE USER 'new_user_name' IDENTIFIED BY '%9v3vdsboq3v5Nyn5I';
  ```
</CodeGroup>

#### Give required permissions to the user:

<CodeGroup>
  ```bash bash theme={null}
  GRANT SELECT ON db_name.table_name TO 'new_user_name';
  ```
</CodeGroup>

#### Verify permissions granted:

<CodeGroup>
  ```bash bash theme={null}
  SELECT \* FROM system.grants WHERE user_name = 'new_user_name';
  ```
</CodeGroup>
