Add quality rules for logical tables

Updated at:

Use the Quality Rule Management page to centrally manage and configure quality rules for your logical tables.

Prerequisites

You have created a logical table. For instructions, see Import logical tables from Excel, Import logical tables from cloud computing resources, or Manually create a logical table.

Background information

  • If an associated field standard is configured for a logical table field, the system automatically generates field rules for certain cloud computing resource types, including Lindorm, RDS MySQL, PostgreSQL, AnalyticDB for PostgreSQL, and PolarDB for PostgreSQL. These rules are then synchronized to and displayed on the Quality Rule Management page.

    Note

    For MaxCompute and Hive cloud computing resource types, the system generates field rules only after you create a partition expression.

  • After you configure rules on a logical table, they are automatically enabled. When you reference the logical table on the data development canvas editing page, a quality check node is automatically generated.

Step 1: Select a rule type

  1. Log on to the Data Resource Platform console.

  2. In the upper-left corner of the page, click the 菜单 icon and choose Collaboration.

  3. In the top menu bar, click the 选择工作组 icon, select your workspace, and then click Quality Assessment.

  4. In the left-side navigation pane, click Quality Rule Management.

  5. On the Quality Rule Management page, click Add Rule in the upper-right corner.

  6. In the Add Rule panel, select the rule type and cloud computing resource type to configure. Rules are categorized as table rules, field rules, and custom SQL rules.

    Note

    The rule type you select determines which configuration options are available. For example, if you choose a table rule, the subsequent options are specific to that rule type.

Step 2: Select a logical table

  1. In the Select Effective Logical Table section, select the logical table for the rule.

  2. In the Select Effective Logical Table section, select a partition.

    Note

    The Select Partition step is required only when the selected cloud computing resource is MaxCompute, Hive, or HiveStorage.

Step 3: Configure the rule

Configure a table rule

If you selected table rule in Step 1: Select a rule type, perform the following steps.

  1. In the Configure Rule section, select a Rule Type. This topic uses a table rule for a MaxCompute resource as an example.

  2. Select the trend and comparison method, and specify the expected value.

    • Strong rule: If this rule fails, the item's data quality is marked as poor.

    • Weak rule: If this rule fails, the item's data quality is marked as fair.

  3. (Optional) Configure advanced options.

    Note
    • Advanced options are used only to provide more granular result data to upper-layer applications through OpenAPI, and do not affect the execution of data development quality nodes or quality assessment plans.

    • Currently, the advanced options are shown only for some rules of the MaxCompute, Hive, and AnalyticDB for PostgreSQL resource types.

    1. Select a grouping field.

    2. Select a time parameter field.

  4. Click OK.

    You can now view the new table rule.

Configure a field rule

If you selected field rule in Step 1: Select a rule type, perform the following steps.

  1. In the Configure Rule section, select a field name.

  2. Select a data type.

    Note

    The following data types are available:

    • System statistics: Provides rules based on statistical metrics, such as maximum value, uniqueness rate, and duplication rate.

    • Data element: For fields linked to a data element standard, the system can automatically generate quality rules, or you can manually select them from the standard. Options include dictionary validation, field type, field length and precision, and UDF validation functions.

    • Dimension: Applies to fields that are associated with a dimension. It includes rules for validating field length and field value types.

  3. Select a rule type and configure the associated fields.

  4. (Optional) Configure advanced options.

    Note
    • The advanced options are used only to provide more granular result data to other applications through OpenAPI. They do not affect the execution of quality check nodes or quality assessment plans.

    • Currently, the advanced options are displayed only for some rules on MaxCompute, Hive, and AnalyticDB for PostgreSQL resource types.

    1. Select a grouping field.

    2. Select a time parameter field.

  5. Click OK.

    You can now view the new field rule.

Configure a custom SQL rule

If you selected custom SQL rule in Step 1: Select a rule type, perform the following steps.

  1. In the Configure Rule section, select a Rule Type. This topic uses a single-table rule as an example.

    Note
    • Single-table custom SQL: Defines a quality rule based on the execution result of a custom SQL statement for a single table.

    • Multi-table custom SQL: Defines a quality rule by using custom SQL and associated custom SQL statements to execute queries on two tables and compare their results.

  2. In the Custom SQL field, enter your custom SQL statement.

  3. Select a comparison method and enter an expected value.

  4. Click OK.

    You can now view the new custom SQL rule.

Step 4: Configure triggered actions

  1. To block a production task based on its quality results, click the image icon to enable the Block Production Scenario toggle. If a rule with this option enabled fails, the system blocks the production task.

  2. To save samples of dirty data based on quality results, click the image icon to enable the Save Dirty Data Samples toggle. When enabled, the system saves samples of dirty data generated by the rule. You can then view and download these samples from the logs or retrieve them by using OpenAPI.

Related operations

Actions

Description

Edit rule

On the rule category page, find the rule, and in the Actions column, click Edit to modify its parameters.

Enable rule

  • To enable a single rule: On the rule category page, find the target rule and click the qo switch in the status column.

  • To enable rules in bulk: On the rule category page, select one or more target rules, and in the lower-left corner, click Batch Operations > Batch Enable.

Disable rule

  • To disable a single rule: On the rule category page, find the target rule and click the 开关 switch in the status column.

  • To disable rules in bulk: On the rule category page, select one or more target rules, and in the lower-left corner, click Batch Operations > Batch Disable.

Delete rule

  • To delete a single rule: On the rule category page, find the target rule, click Delete in the Actions column, and then click OK in the confirmation dialog box.

  • To delete rules in bulk:

    1. On the rule category page, select one or more rules to delete, and then click Batch Operations > Delete in the lower-left corner.

    2. In the dialog box, click Delete to delete the selected rules.

Next steps

After configuring quality rules, you must either create and run a quality check plan or reference the rule's associated physical table on the data development canvas. For more information, see Create and enable a quality check plan for a physical table or Reference quality rules for a physical table.