Configure the ClickHouse input component
The ClickHouse input component reads data from a ClickHouse data source. To synchronize data from a ClickHouse source to a destination, first configure the ClickHouse input component, then configure the destination data source. This topic describes how to configure the ClickHouse input component.
Prerequisites
-
A ClickHouse data source has been created. For more information, see Create a ClickHouse data source.
-
Your account must have the sync read permission for the data source. If you do not have the required permission, you must apply for it. For more information, see Apply for data source permissions.
Procedure
-
In the top navigation bar of the Dataphin homepage, choose Develop > Data Integration.
-
In the top navigation bar of the integration page, select a project. If you are in Dev-Prod mode, you also need to select an environment.
-
In the left-side navigation pane, click Offline Integration. In the Offline Integration list, click an Offline Pipeline to open its configuration page.
-
In the upper-right corner of the page, click Component Library to open the Component Library panel.
-
In the left-side navigation pane of the Component Library panel, select Input. In the list of input components on the right, find the ClickHouse component and drag it onto the canvas.
-
Click the
icon on the ClickHouse input component card to open the ClickHouse input configuration dialog box. -
In the ClickHouse input configuration dialog box, configure the parameters.
Parameter
Description
step name
The name of the component. Dataphin automatically generates a step name, which you can change to fit your business scenario. The naming rules are as follows:
-
Can contain only Chinese characters, letters, underscores (_), and digits.
-
Cannot exceed 64 characters.
data source
The data source drop-down list displays all ClickHouse data sources in Dataphin, including those with and without sync read permission. Click the
icon to copy the name of the current data source.-
If you do not have sync read permission for a data source, click Apply next to it to request permission. For more information, see Apply for data source permissions.
-
If you do not have a ClickHouse data source, click Create data source to create one. For more information, see Create a ClickHouse data source.
number of source tables
Select the number of source tables. Options include single table and multiple tables.
-
single table: Synchronizes data from a single source table to a single destination table.
-
multiple tables: Synchronizes data from multiple source tables to a single destination table. A union operation is used to combine the data.
For more information about the union operation, see INTERSECT, UNION, and EXCEPT.
Table matching method
You can select General rules or Database regex.
NoteThis setting is supported only when the number of source tables is set to multiple tables.
Table
Select the source table or tables.
-
If number of source tables is set to single table, you can enter a table name keyword to search, or enter the exact table name and click Exact Search. After you select a table, the system automatically checks the table status. Click the
icon to copy the name of the currently selected table. -
If you set number of source tables to multiple tables, you can enter different expressions to add tables based on the table matching method.
-
If you set the table matching method to General rules, enter a table expression in the input box to filter for tables with the same schema. The system supports enumeration, regular expression-like patterns, and a mix of both. For example:
table_[001-100];table_102;. -
If you set the table matching method to Database regex, enter a regular expression supported by the current database. The system uses this expression to match tables in the source database. When the task runs, it dynamically matches a new set of tables for synchronization based on the regular expression.
After you enter the expression, you can click Exact match to view a list of matched tables in the Confirm match details dialog box.
-
split key (Optional)
The system shards data based on the configured split key. This parameter can be used with the concurrency setting to enable parallel reads. You can select a column from the source table to use as the split key. For optimal transfer performance, we recommend using a primary key or an indexed column as the split key.
ImportantWhen you select a column of a date or time data type, the system performs a brute-force split by identifying the minimum and maximum values and dividing the total time range based on the concurrency. This method does not guarantee an even data distribution.
batch size (Optional)
Specifies the number of records to read in a single batch. When reading from the source database, you can specify a batch size, such as 1,024 records, instead of reading one record at a time. This reduces the number of interactions with the data source, improves I/O efficiency, and lowers network latency.
input filter (Optional)
Specify a filter condition to extract specific data. The following formats are supported:
-
Fixed value: Extracts data that matches a specific value. For example,
ds=20210101. -
Variable: Extracts a subset of data by using a variable. For example,
ds=${bizdate}.
output fields
The output fields section displays all fields from the selected table or tables that match the filter conditions. You can perform the following actions:
-
Manage fields: Remove any fields that you do not need to output to downstream components.
-
To remove a single field: Click the
icon in the Actions column for that field. -
To remove multiple fields: Click Manage fields. In the Manage fields dialog box, select the fields that you want to remove, click the
left-arrow icon to move them to the unselected list, and then click OK.
-
-
Batch add: Click Batch add to configure fields in bulk by using the JSON, TEXT, or DDL format.
NoteAfter you add fields in bulk, clicking OK overwrites all existing field configurations.
-
To add fields in bulk by using the JSON format, see the following example:
// Example: [{ "index": 1, "name": "id", "type": "int(10)", "mapType": "Long", "comment": "comment1" }, { "index": 2, "name": "user_name", "type": "varchar(255)", "mapType": "String", "comment": "comment2" }]NoteIn the JSON code,
indexis the ordinal position of the column (starting from 1),nameis the field name, andtypeis the data type. For example,"index":3,"name":"user_id","type":"String"specifies that the third column in the source file is imported as a field named user_id with the String data type. -
To add fields in bulk by using the TEXT format, see the following example:
// Example: 1,id,int(10),Long,comment1 2,user_name,varchar(255),Long,comment2-
Row delimiter: Separates each field's information. By default, the newline character (\n) is used. Semicolons (;) and periods (.) are also supported.
-
Column delimiter: Separates the field name from the field type. By default, a comma (,) is used. The field type is optional.
-
-
To add fields in bulk by using the DDL format, see the following example:
CREATE TABLE tablename ( user_id serial, username VARCHAR(50), password VARCHAR(50), email VARCHAR (255), created_on TIMESTAMP, );
-
-
Add new output field: Click + New output field and specify the Field, Type, and Comment, and select a mapping type. After you configure the row, click the
icon to save the configuration.system fields: You can select system fields to identify the source of each row of data. This is useful when you synchronize data from multiple tables, such as sharded databases and tables, to a single destination table. After you select a system field, the system automatically populates the field type and mapping type. The following system fields are available:
-
dp_datasource: Name of the data source. -
dp_dbname: Name of the database, if any. -
dp_schema: Name of the schema, if any. -
dp_source_table: Name of the source table. -
dp_read_timestamp: Time when the SELECT operation started at the source.
You can concatenate multiple system variables. For example:
dp_dbname.dp_source_table.Note-
The field type and mapping type of system fields cannot be modified.
-
The
dp_read_timestampfield can be configured only as a standalone field and cannot be concatenated.
-
-
-
Click OK to complete the property configuration for the ClickHouse input component.

icon to save the configuration.