Updated on 2025-04-16 GMT+08:00

Adding a User-Defined Data Type

If the default data types cannot meet service requirements, you can create custom data types.

Regular expressions are patterns used to match strings, check if a string contains a certain substring, replace matching substrings, or extract substrings that meet certain criteria.

Procedure

  1. Log in to a database encryption and access control instance as the sysadmin user.
  2. In the navigation tree on the left, choose Sensitive Data Discovery > Data Type Management.
  3. On the Data Type List page, click Add Custom Type in the upper right corner.
  4. In the displayed dialog box, configure the custom data type.

    You can create user-defined data types by matching Column or Data Content.

    • Matching column
      Figure 1 Matching column
      Table 1 Matching column

      Parameter

      Description

      Data Type

      Set a custom data type name for further management.

      Definition Mode

      Select a column name.

      Column

      Enter a keyword or a regular expression.

      Note: If a column name contains a keyword or matches a regular expression, the column name is matched.

      Data Type

      Select the corresponding data type.

      Built-in types include numbers, strings, address groups, ID card numbers, email addresses, ID card numbers, mobile numbers, and dates.

      Data Type Explanation

      Enter the description about the data type.

    • Matching data content
      Figure 2 Matching data content
      Table 2 Matching data content

      Parameter

      Description

      Data Type

      Set a custom data type name for further management.

      Definition Mode

      Set Definition Mode to Data Content.

      Regular Expression

      Set the regular expression for matching user-defined data.

      For example, the regular expression of a mobile number is as follows:

      0?(13|14|15|17|18)[0-9]{9}

      Data Type Explanation

      Enter the description about the data type.

  5. Click Save.

    Then, you can view the added custom data type in the data type list.

    Figure 3 Custom data type

  6. (Optional) Click Test and enter the test data to check whether the custom type meets the expected result.

Related Operations

You can perform the following operations on the data type list page as required.

  • Editing a user-defined data type: Click Edit to modify the custom data type.
  • Deleting a user-defined data type: Click Delete to delete unused custom data types.