The Microsoft SQL Server input component reads data from a Microsoft SQL Server data source. When you need to synchronize data from a Microsoft SQL Server data source to other data sources, you must first configure the Microsoft SQL Server input component to read the data source, and then configure the target data source for data synchronization. This topic describes how to configure a Microsoft SQL Server input component.
Prerequisites
A Microsoft SQL Server data source is created. For more information, see Create a Microsoft SQL Server data source.
The account used to configure the Microsoft SQL Server input component properties has read-through permission for the data source. If you do not have the permission, you need to request the data source permission. For more information, see Request, renew, and return 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 Project (In Dev-Prod mode, you need to select an environment).
In the left-side navigation pane, click Batch Pipeline. In the Batch Pipeline list, click the offline pipeline that you want to develop to open its configuration page.
Click Component Library in the upper-right corner of the page to open the Component Library panel.
In the left-side navigation pane of the Component Library panel, select Inputs. Find the Microsoft SQL Server component in the input component list on the right, and drag it to the canvas.
Click the
icon in the Microsoft SQL Server input component card to open the Microsoft SQL Server Input Configuration dialog box.In the Microsoft SQL Server Input Configuration dialog box, configure the parameters.
Parameter
Description
Step Name
The name of the Microsoft SQL Server input component. Dataphin automatically generates a step name, which you can modify based on your business scenario. The name must meet the following requirements:
It can contain only Chinese characters, letters, underscores (_), and digits.
It can be up to 64 characters in length.
Datasource
The data source dropdown list displays all Microsoft SQL Server data sources, including those for which you have read-through permission and those for which you do not. Click the
icon to copy the current data source name. For data sources for which you do not have read-through permission, you can click Request after the data source to request read-through permission for the data source. For more information, see Request, renew, and return data source permissions.
If you do not have a Microsoft SQL Server data source, click Create Data Source to create one. For more information, see Create a Microsoft SQL Server data source.
Time Zone
The time zone based on which time format data is processed. The default is the time zone configured in the selected data source, which cannot be modified.
NoteFor tasks created before V5.1.2, you can select Default Data Source Configuration or Channel Configuration Time Zone. The default is Channel Configuration Time Zone.
Default Data Source Configuration: The default time zone of the selected data source.
Channel Configuration Time Zone: The time zone configured in Properties > Channel Configuration for the current integration task.
Schema (Optional)
Supports cross-schema table selection. Select the schema where the table is located. If not specified, the default is the schema configured in the data source.
Source Table Quantity
Select the source table quantity. Options include Single Table and Multiple Tables:
Single Table: Applicable to scenarios where business data from one table is synchronized to a target table.
Multiple Tables: Applicable to scenarios where business data from multiple tables is synchronized to the same target table. When data from multiple tables is written to the same data table, the union algorithm is used.
Table
Select the source table:
If you selected Single Table for Source Table Quantity, you can enter a keyword to search for the table, or enter the exact table name and click Exact Match. 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 selected Multiple Tables for Source Table, perform the following operations to add tables:
In the input box, enter a table expression to filter tables with the same structure.
The system supports enumeration, regular expression-like formats, and a combination of both. For example,
table_[001-100];table_102.Click Exact Match. In the Confirm Match Details dialog box, view the list of matched tables.
Click OK.
Shard Key (Optional)
The system shards data based on the configured shard key field, which can be used with the concurrency configuration to implement concurrent reading. You can use a column in the source data table as the shard key. We recommend that you use the primary key or a column with an index as the shard key to ensure transmission performance.
ImportantWhen you select a date-time type, the system identifies the maximum and minimum values, and performs forced sharding based on the total time range and concurrency. Even distribution is not guaranteed.
Batch Read Count (Optional)
The number of records to read at a time. When reading data from the source database, you can configure a specific batch read count (such as 1,024 records) instead of reading records one by one. This reduces the number of interactions with the data source, improves I/O efficiency, and reduces network latency.
Input Filter (Optional)
Enter filter information for the input fields, for example,
ds=${bizdate}. Input Filter is applicable to the following two scenarios:Fixed part of data.
Parameter filtering.
Hint (Optional)
Table Hints are a mechanism used to influence the query optimizer's choice of how to access tables or views. By using specific hints in query statements, you can force the database management system to use a specific execution plan to process the query, rather than relying on the default optimization strategy.
You can apply these hints by using parentheses to include the hint after the table name in the FROM clause, separating multiple hints with commas. For example:
SELECT * FROM MyTable WITH (INDEX(IX_MyIndex), NOLOCK)
Output Fields
The Output Fields area displays all fields from the selected table and those that match the filter conditions. You can perform the following operations:
Field Management: If you do not need to output certain fields to downstream components, you can delete those fields:
Single field deletion scenario: If you need to delete a small number of fields, you can click the
icon in the Operation column to delete the unnecessary fields.Batch field deletion scenario: If you need to delete many fields, you can click Field Management. In the Field Management dialog box, select multiple fields, click the
left arrow icon to move the selected input fields to the unselected input fields, and then click OK to complete the batch deletion of fields.
Batch Add: Click Batch Add to configure fields in JSON, TEXT, or DDL format.
NoteAfter you complete the batch addition and click OK, the system will overwrite the configured field information.
Batch configuration in JSON format, for example:
// Example: [ { "index": 1, "name": "Id", "type": "int(10)", "mapType": "Long", "comment": "" }, { "index": 2, "name": "Data", "type": "nvarchar(100)", "mapType": "String", "comment": "" } ]Noteindex indicates the column number of the specified object, name indicates the field name after import, and type indicates the field type after import. For example,
"index":3,"name":"user_id","type":"String"means importing the 4th column from the file, with the field name as user_id and the field type as String.Batch configuration in TEXT format, for example:
// Example: 1,Id,int(10),Long, 2,Data,nvarchar(100),String, 3,RowVersion,timestamp,Bytes,The row delimiter is used to separate the information of each field. The default is a line feed (\n). Supported delimiters include line feed (\n), semicolon (;), and period (.).
The column delimiter is used to separate the field name and field type. The default is a comma (,). Supported delimiter is
','. The field type can be omitted, with the default being','.
Batch configuration in DDL format, for example:
CREATE TABLE tablename ( user_id serial, username VARCHAR(50), password VARCHAR(50), email VARCHAR (255), created_on TIMESTAMP, );
Create Output Field: Click +Create Output Field, and fill in Column, Type, Comment, and select Mapping Type as prompted. After you complete the configuration for the current row, click the
icon to save it.
Click OK to complete the property configuration of the Microsoft SQL Server input component.