|
| 1 | +# ClickHouse connector |
| 2 | + |
| 3 | +Parent document: [Connectors](../README.md) |
| 4 | + |
| 5 | +**BitSail** ClickHouse connector can be used to read data in ClickHouse, mainly supports the following functions: |
| 6 | + |
| 7 | +- Support batch reading of ClickHouse tables |
| 8 | +- JDBC Driver version: 0.3.2-patch11 |
| 9 | + |
| 10 | +## Maven dependency |
| 11 | + |
| 12 | +```xml |
| 13 | +<dependency> |
| 14 | + <groupId>com.bytedance.bitsail</groupId> |
| 15 | + <artifactId>connector-clickhouse</artifactId> |
| 16 | + <version>${revision}</version> |
| 17 | +</dependency> |
| 18 | +``` |
| 19 | + |
| 20 | +## ClickHouse reader |
| 21 | + |
| 22 | +### Supported data types |
| 23 | + |
| 24 | +The following basic data types are supported: |
| 25 | + |
| 26 | +- Int8 |
| 27 | +- Int16 |
| 28 | +- Int32 |
| 29 | +- Int64 |
| 30 | +- UInt8 |
| 31 | +- UInt16 |
| 32 | +- UInt32 |
| 33 | +- UInt64 |
| 34 | +- Float32 |
| 35 | +- Float64 |
| 36 | +- Decimal |
| 37 | +- Date |
| 38 | +- String |
| 39 | + |
| 40 | +### Parameters |
| 41 | + |
| 42 | +Read connector parameters are configured in `job.reader`, please pay attention to the path prefix when actually using it. Example of parameter configuration: |
| 43 | + |
| 44 | +```json |
| 45 | +{ |
| 46 | + "job": { |
| 47 | + "reader": { |
| 48 | + "class": "com.bytedance.bitsail.connector.clickhouse.source.ClickhouseSource", |
| 49 | + "jdbc_url": "jdbc:clickhouse://127.0.0.1:8123", |
| 50 | + "user_name": "default", |
| 51 | + "password": "1234567", |
| 52 | + "db_name": "default", |
| 53 | + "table_name": "test_ch_table", |
| 54 | + "split_field": "id", |
| 55 | + "split_config": "{\"lower_bound\": 0, \"upper_bound\": 10000, \"split_num\": 3}", |
| 56 | + "sql_filter": "( id % 2 == 0 )" |
| 57 | + } |
| 58 | + } |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +#### Required parameters |
| 63 | + |
| 64 | +| Parameter name | Required | Optional value | Description | |
| 65 | +|:---------------|:---------|:-------------------------------------------------|:------------------------------| |
| 66 | +| class | yes | `com.bytedance.bitsail.connector.clickhouse.source.ClickhouseSource` | ClickHouse read connector type | |
| 67 | +| jdbc_url | yes | | JDBC connection address of ClickHouse | |
| 68 | +| db_name | yes | | ClickHouse library to read | |
| 69 | +| table_name | yes | | ClickHouse table to read | |
| 70 | + |
| 71 | +<!--AGGREGATE<br/>DUPLICATE--> |
| 72 | + |
| 73 | +#### Optional parameters |
| 74 | + |
| 75 | +| Parameter name | Required | Optional value | Description | |
| 76 | +|:-------------------|:---------|:---------------|:---------------------------------------------------| |
| 77 | +| user_name | no | | Username to access ClickHouse services | |
| 78 | +| password | no | | The password of the above user | |
| 79 | +| split_field | no | | Batch query fields, only support Int8 - Int64 and UInt8 - UInt32 integer types | |
| 80 | +| split_config | no | | The configuration for batch query according to `split_field` field, including initial value, maximum value and query times, <p/> For example: `{"lower_bound": 0, "upper_bound": 10000, "split_num": 3}` | |
| 81 | +| sql_filter | no | | The filter condition of the query, such as `( id % 2 == 0 )`, will be spliced into the WHERE clause of the query SQL | |
| 82 | +| reader_parallelism_num | no | | ClickHouse reader parallelism num | |
| 83 | + |
| 84 | +## Related documents |
| 85 | + |
| 86 | +Configuration example: [ClickHouse connector example](./clickhouse-example.md) |
0 commit comments