> For the complete documentation index, see [llms.txt](https://docs.soda.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.soda.io/soda-documentation/soda-v3/data-source-reference/connect-clickhouse.md).

# Connect Soda to ClickHouse

Access configuration details to connect Soda to a ClickHouse data source.

> For Soda to run quality scans on your data, you must configure it to connect to your data source.\
> To learn how to set up Soda and configure it to connect to your data sources, see [Get started](/soda-documentation/soda-v3/quick-start-sip/setup-guide.md).

## Connection configuration reference

Because ClickHouse is compatible with MySQL wire protocol, Soda offers indirect support for ClickHouse data sources using the `soda-mysql` package.

```yaml
data_source my_datasource_name:
  type: mysql
  host: 127.0.0.1
  port: `9004`
  username: simple
  password: simple_pass
  database: customers
```

| Property | Required | Notes                                                 |
| -------- | -------- | ----------------------------------------------------- |
| type     | required | Identify the type of data source for Soda.            |
| host     | required | Provide a host identifier.                            |
| port     | required | Provide a port identifier.                            |
| username | required | Use system variables to retrieve this value securely. |
| password | required | Use system variables to retrieve this value securely. |
| database | required | Provide an identifier for your database.              |

## Test the data source connection <a href="#test-the-data-source-connection" id="test-the-data-source-connection"></a>

To confirm that you have correctly configured the connection details for the data source(s) in your configuration YAML file, use the `test-connection` command. If you wish, add a `-V` option to the command to returns results in verbose mode in the CLI.

```python
soda test-connection -d my_datasource -c configuration.yml -V
```

## Supported data types

| Category | Data type                                                                              |
| -------- | -------------------------------------------------------------------------------------- |
| text     | CHAR, VARCHAR, TEXT                                                                    |
| number   | BIG INT, NUMERIC, BIT, SMALLINT, DECIMAL, SMALLMONEY, INT, TINYINT, MONEY, FLOAT, REAL |
| time     | DATE, TIME, DATETIME, DATETIMEOFFSET                                                   |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.soda.io/soda-documentation/soda-v3/data-source-reference/connect-clickhouse.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
