Create quality rules for real-time metatables
This topic describes how to create a quality rule for a real-time metatable.
Prerequisites
Add a monitoring object before configuring quality rules. For more information, see Add a monitoring object.
Permissions
A super administrator, quality administrator, real-time metatable owner, a user with a custom global role that includes the Quality Rule - Manage permission, or a user with a custom project role that includes the Project Quality Management - Quality Rule Management permission for the project where the metatable is located can configure schedules, alerts, and runtime configurations for quality rules.
Quality owners and standard users also need synchronous read permissions for the real-time metatable. To request permissions, see Apply for, Renew, and Return Table Permissions.
Supported operations depend on the object type. For details, see Quality Rule Operation Permissions.
Trial run vs. regular run
A trial run and a regular run differ in execution and result visibility. A trial run simulates a quality rule to verify its behavior without publishing results to the quality report. A regular run executes the quality rule at a specified time and publishes its results to the quality report.
Metatable rule types
Rule type | Description |
Statistical trend monitoring | Verifies data values and data change trends. |
Real-time multi-link comparison | For business scenarios requiring high reliability, use real-time dual- or triple-link quality rules to monitor data. If an anomaly occurs, operations staff can quickly switch to a different link or back up data. Real-time multi-link comparison quality rules can monitor issues such as data retention and statistical deviation. |
Real-time and offline data reconciliation | A real-time and offline data reconciliation quality rule detects discrepancies between real-time and offline data that use the same statistical logic. A significant discrepancy may indicate a data quality issue. |
Configure quality rules
On the Dataphin home page, choose Governance > Data Quality from the top navigation bar.
In the left-side navigation pane, click Quality Rule. On the Real-time Metatable page, click the name of the target object to open the Quality Rule Details page and configure a quality rule.
On the Quality Rule Details page, click New Quality Rule.
In the Create Quality Rule dialog box, configure the parameters.
Parameter
Description
Basic information
Rule name
Enter a custom name for the quality rule.
Rule severity
You can select weak rule or strong rule.
If you select weak rule, an alert is triggered if the rule check fails, but downstream tasks are not blocked.
If you select strong rule, an alert is triggered if the rule check fails. If there are downstream tasks (in code check schedules or task-triggered schedules), they are blocked to prevent the propagation of poor-quality data. If there are no downstream tasks (such as in periodic quality schedules), only an alert is triggered.
Description
Enter a custom description for the quality rule. The description can be up to 128 characters long.
Rule template
You can select a consistency or stability rule template.
Consistency: Includes Real-time vs. Offline Comparison and Real-time Link Comparison.
Stability: Includes Real-time Statistical Value Check.
For more information, see Real-time metatable template types.
Rule type
The rule type depends on the template. It is a fundamental attribute of the template and can be used for description and filtering purposes.
Rule configuration
Rule configuration
Configure the rule based on the selected Rule template. For more information, see Real-time metatable parameter configuration and Multi-link comparison parameter configuration.
Check configuration
Rule check
After checking a data quality rule, the system compares the result with the anomaly check configuration. The check fails if the conditions are met, triggering subsequent processes like alerting.
The available metrics for anomaly checks are determined by the template and its configuration. You can use multiple AND/OR conditions, but we recommend using no more than three.
For more information, see Check configuration description.
Business attribute configuration
Attribute information
How you specify business attributes depends on the attribute's configuration in the quality rule. For example, if the value type for the responsible department field is an enumeration (multi-select) with options like Big Data Department, Business Department, and Technology Department, then this attribute appears as a multi-select drop-down menu when you create a quality rule.
If the value type for the rule owner field is custom input with a maximum length of 256 characters, you can enter a value of up to 256 characters when creating the quality rule.
If the input method for an attribute field is Range, configure it as follows:
Range: This is typically used for continuous numerical values or dates. You can select one of four symbols: >, >=, <, or <=. For more information about attribute configuration, see Create and manage quality rule attributes.
Scheduling attribute configuration
Scheduling method
You can select an existing schedule. If you have not decided on a scheduling method, you can configure it after creating the quality rule. To create a schedule, see Create a schedule.
Click OK to save the quality rule configuration.
You can click Preview SQL to view the changes in the SQL statement compared to the last saved version.
NoteThe Preview SQL button is disabled if required information is missing.
The left pane shows the SQL preview of the last saved configuration. If no configuration was saved, this pane is empty. The right pane shows the SQL preview of the current configuration.
Rule configuration list
On the rule configuration list page, you can view information about the configured metatable rules and perform operations such as viewing, editing, running a trial, running, and deleting them.

Area | Description |
① Filter and search area | You can search for rules by object name or rule name. You can filter rules by rule type, rule template, rule severity, trial run status, and activation status. Note If a business attribute is configured to be searchable or filterable and is enabled in the quality rule attribute configuration, you can use it to search or filter rules. |
② List area | Displays a list of rule configurations, including Object type/Name, Rule name/ID, Trial run status, Activation status, Rule type, Rule template, Rule severity, Schedule type, Related knowledge base document, Last updated by, and Last updated time. Click the
|
③ Operations area | You can perform operations such as View, Clone, Edit, Trial run, Run, Configure scheduling, Associate knowledge base document, and Delete.
|
④ Batch operations area | You can perform batch operations such as Trial run, Run, Configure scheduling, Enable, Disable, Modify business attributes, Associate knowledge base document, and Delete.
|
Create a schedule
Each table supports a maximum of 20 schedules.
A single rule can be associated with a maximum of 10 schedules.
Duplicate schedules with identical configurations are automatically removed.
On the Quality Rule Details page, click the Scheduling Configuration tab, and then click Create Schedule to open the Create Schedule dialog box.
In the Create Schedule dialog box, configure the parameters.
Parameter
Description
Schedule name
Enter a custom name for the schedule.
Schedule type
You can select timed schedule, data update-triggered schedule, or fixed task-triggered schedule.
Timed schedule: Performs periodic data quality checks based on a set schedule. This is suitable for scenarios where data generation times are relatively fixed.
Scheduling cycle: Running a quality rule consumes computing resources. We recommend that you avoid running multiple quality rules concurrently to prevent disrupting production tasks. The available scheduling cycles are Day, Week, Month, Hour, and Minute.
If the system time zone (the time zone in User Center) differs from the scheduling time zone (the time zone configured in Management Center > System Settings > Basic Settings), the rule runs according to the system time zone.
Data update-triggered schedule: When any code task runs, the system checks whether the task updates the specified check scope of the current table. This is suitable for tables whose modification tasks are not fixed or for tables that require close monitoring of every change.
NoteWe recommend setting the check scope to the partitions updated by the task. For non-partitioned tables, the entire table is checked. The system automatically detects all data changes and performs the check to avoid omissions.
Fixed task-triggered schedule: This schedule type runs the configured quality rule before or after a specified task completes successfully. You can select tasks of the following engine types to trigger the quality rule: SQL, Offline Pipeline, Python, Shell, Virtual, Dlink, and Database SQL. This approach is ideal when table modification tasks are fixed.
NoteYou can only select tasks from the production environment for fixed task triggers. If the rule is a strong rule, a check failure may affect online tasks. Use this feature with caution based on your business requirements.
The supported engine types are MaxCompute.
Trigger condition: Select when to trigger the data quality check. Options include Trigger after all tasks run successfully, Trigger after each task runs successfully, and Trigger before each run of each task.
Triggering task: The following roles can select a task node in a production project to trigger the task. You can also search by node output name.
Project administrators of Prod/Basic projects, users with the O&M system role in Prod projects, users with the Developer system role in Basic projects, and users with a custom project role that includes the Project Quality Management - Quality Rule Management permission in Prod/Basic projects can select task nodes from production projects.
Users with a custom global role that includes the Quality Rule - Manage permission in Prod/Basic projects can select task nodes from all production projects.
NoteIf you select Trigger after all tasks run successfully, we recommend selecting tasks with the same scheduling cycle to avoid delays in rule execution and data quality check results.
Scheduling conditions
This is disabled by default. If enabled, the system evaluates the scheduling conditions before running the rule. The schedule runs only if the conditions are met; otherwise, the run is skipped.
Business Date/Execution Date: If the schedule type is Timed Schedule (which does not support execution date), Data Update-triggered Schedule, or Fixed Task-triggered Schedule, you can configure a date. You can select a General Calendar or a Custom Calendar. For information about how to create a custom calendar, see Create and manage public calendars.
If you select General Calendar, the available conditions are Month, Day of Week, and Date. Example:

If you select Custom Calendar, the available conditions are Date Type and Tag. Example:

Instance type: If the schedule type is data update-triggered schedule or fixed task-triggered schedule, you can configure the instance type. Options are periodic instance, backfill instance, and Manual Instance. Example:

NoteYou must configure at least one rule. To add a rule, click the +Add Rule button.
You can configure a maximum of 10 scheduling conditions.
You can set the relationship between scheduling conditions to AND or OR.
Click OK to save the scheduling configuration.
Scheduling configuration list
After a schedule is created, you can view, edit, clone, or delete it from the scheduling configuration list.

Area | Description |
① Filter and search area | You can search for a schedule by its name. You can filter by timed schedule, data update-triggered schedule, or fixed task-triggered schedule. |
② List area | Displays the Schedule name, Schedule type, Last updated by, and Last updated time for each rule configuration. |
③ Operations area | You can edit, clone, or delete a schedule.
|
Alert configuration
You can configure different notification methods for different rules to prioritize alerts based on severity. For example, you can use phone call alerts for strong rule failures and SMS alerts for weak rule failures. If a rule matches multiple alert configurations, you can set an activation policy.
You can create a maximum of 20 alert configurations for a single monitoring object.
On the Quality Rule Details page, click the Alert Configuration tab, and then click Create Alert Configuration to open the Create Alert Configuration dialog box.
In the Create Alert Configuration dialog box, configure the parameters.
Parameter
Description
Effective scope
You can select All Rules, All Strong Rules, All Weak Rules, or Custom.
NoteFor a single monitoring object, you can set one alert configuration for each of the three scopes: all rules, all strong rules, and all weak rules. Newly added rules will automatically match the corresponding alert configuration based on their rule severity. To change one of these configurations, you must edit the existing one.
The custom scope can include up to 200 existing rules for the current monitoring object.
Alert configuration name
The alert configuration name must be unique within a single monitoring object and can be up to 256 characters long.
Alert recipient
Configure the alert recipients and notification methods. You must select at least one alert recipient and one notification method.
Alert recipient: You can select Custom, On-call Schedule, or Quality Owner.
You can configure up to 5 custom alert recipients and up to 3 on-call schedules.
Notification method: You can select Phone, Email, SMS, DingTalk as notification methods.
Click OK to save the alert configuration.
Alert configuration list
After an alert configuration is created, you can sort, edit, or delete it from the alert configuration list.

No. | Description |
① Sorting area | Configure the activation policy for when a quality rule matches multiple alert configurations:
|
② List area | Displays the name, effective scope, specific recipients for each alert type, and their corresponding notification methods for each alert configuration. Effective scope: For custom alerts, you can view the configured object name and rule name. If the rule is deleted, the object name cannot be viewed. We recommend updating the alert configuration in this case.
|
③ Operations area | You can edit or delete an alert configuration.
|
Quality report
Click Quality Report to view the Rule Check Overview and Rule Check Details for the current quality rule.
You can quickly filter check details by anomaly result, partition time, or by rule or object name keywords.
In the Actions column of the Rule Check Details list, click the
icon to view the rule check details for the quality rule.In the Actions column of the Rule Check Details list, click the
icon to view the execution logs for the quality rule.
Quality rule permission management
Click Permission Management to configure the Access to Details setting, which controls which members can view check records, quality rule details, and quality reports.
Access to Details: You can select All Members or Only members with quality management permissions for the current object.
Click OK to save the permission management configuration.
Quality rule runtime configuration
If a quality rule task times out, the system automatically terminates it and marks its status as failed. You can view the corresponding execution log on the check record details page.
For a quality rule task that is retried upon failure, you can view the records of multiple retry attempts in the execution log on the check record details page.
All quality rules under a single monitoring object, including newly created ones and existing ones that have not yet run, will follow the latest runtime configuration.
Click the Runtime Configuration tab, then click the Edit button at the bottom to configure the parameters.
Parameter
Description
Effective scope
You can select All Rules, All Strong Rules, All Weak Rules, or Custom.
Run timeout
If a quality rule task's total runtime (which excludes time spent waiting for resources or scheduling) exceeds the configured threshold, the system terminates the task and marks it as failed. The default timeout is 1 hour. You can set a custom duration from 0 to 2 hours, with precision to two decimal places.
Automatic retry upon failure
You can configure failed quality rule tasks to retry automatically. This feature is disabled by default. If you enable it, you can set the Number of Retries and Retry Interval.
Number of Retries: The maximum number of automatic retries for a failed quality rule task. The default is 1, and you can set an integer from 1 to 3.
Retry Interval: The time interval between automatic retries. The default is 0 minutes, and you can set an integer from 0 to 10 minutes.
Click OK to save the runtime configuration.
Next steps
After you configure the quality rule, you can view it in the real-time metatable rule list. For more information, see Manage the monitoring object list.

