Create a data source

Updated at:

This topic describes how to create data sources. You can create file-based and DB-based data sources.

Create a file-based data source

  1. Log on to the Capital Security Monitoring console. In the navigation pane on the left, click Data Source.

  2. On the Data Source page, click New Data Source.

  3. On the New Data Source page, configure the following parameters:

    • Data source name: The name of the data source. The name must be unique within a tenant, be 1 to 100 characters long, and can contain letters, digits, underscores (_), and hyphens (-).

    • Create Class: Select File. This setting cannot be modified once the class is created.

    • File type: The options are OSS and FTP.

    • File path: The path where the file is stored. Regular expressions are supported.

    • Data source configuration: Select a data source configuration. You can also enter a keyword to search for a configuration by name. If a required configuration does not exist, click New Data Source Configuration on the right to create one. For more information, see Create a data source configuration.

    • File properties: Select Enter by row in a table or Import from JSON. In this example, Enter by row in a table is selected.

      Note

      If you select Import from JSON, configure the following parameters to create the data source:

      • File template: The options are CSDC 01, CSDC 02, CSDC 03, CSDC 04, CSDC 05, CSDC 06, and CSDC 07. Select a template as needed.

      • JSON-formatted data: You do not need to enter this information manually because the system automatically populates this field based on the selected File template.

    • File encoding: The file encoding type. The supported types are UTF-8 and GBK.

    • File protocol: The file protocol defines how the file is parsed. The supported protocols are SP, DE, and FUND. For more information, see the following table.

      Protocol Type

      Description

      Scenarios

      SP

      Simple Protocol (SP) layout template

      • The file has no file header or column headers.

      • The file has only column headers and content.

      DE

      A file exchange format provided by Ant Group

      The first line is the file header, the second line contains the column headers, and the third line and all subsequent lines contain the file content.

      FUND

      National standard fund data protocol

      The first few lines are headers, followed by the file content. The file content is split by length.

    • Separator: The separator used between fields.

    • Fields: Configure the following parameters. To add more fields, click Add Property.

      • Classification: The supported types are body and head.

      • Field name: The name of the field.

      • Description: A brief description of the field.

      • Type: The supported types are String, BigDecimal, Date, Money, and Integer.

      • Length: The length of the field.

  4. After you finish the configuration, click Submit.

Create a DB-based data source

  1. Log on to the Capital Security Monitoring console. In the navigation pane on the left, click Data Source.

  2. On the Data Source page, click New Data Source.

  3. On the New Data Source page, configure the following parameters:

    • Data source name: The name of the data source. The name must be unique within a tenant, be 1 to 100 characters long, and can contain letters, digits, underscores (_), and hyphens (-).

    • Class: Select DB. You cannot change this setting after it is created.

    • Enable sharding: Specifies whether to enable sharding. In this example, No is selected, which means sharding is disabled.

      Note

      If you select Yes, specify the Sharding rule. The rule is implemented as a Groovy script.

    • Data source configuration: Select a data source configuration. You can also enter a keyword to search for a configuration by name. If a required configuration does not exist, click New Data Source Configuration on the right to create one. For more information, see Create a data source configuration.

    • Associated table: Select an associated data table. You can also enter a keyword to search for a data table by name.

    • SQL expression: Enter an SQL expression to retrieve the data to be checked from the DB.