Create Quality Rules In Batch
Creating quality rules in batch lets you apply a consistent set of rules to multiple monitored objects and configure alarms to track their status in real time.
Prerequisites
The data tables or metrics that you want to monitor have been published to the production environment. For more information, see Manage release tasks.
Permissions
Super administrators and quality administrators can create quality rules in batch, create and delete exception archiving tables, and configure quality score weights.
Quality owners can perform these operations on the monitored objects for which they are responsible.
Quality owners and normal users must have read permissions on the data tables and data sources. To apply for permissions, see Apply for, renew, and revoke table permissions and Apply for data source permissions.
Permissions vary by object. For more information, see Quality rule operation permissions.
You can configure exception archiving tables and quality score weights only for Dataphin tables and global data tables.
How quality rules work
If a quality check violates a weak rule, the system sends an alarm to help you handle the exception promptly; the task is not interrupted. If it violates a strong rule, the system interrupts the task to prevent dirty data from flowing to downstream tasks and sends an alarm.
Add quality rules in batch
Add quality rules in batch to efficiently apply the same rule to multiple objects at the table or field level. The process is similar for all monitored objects, differing only in the object selection method. The following procedure uses a Dataphin table as an example.
On the Dataphin homepage, click Governance > Data quality in the top menu bar.
In the left-side navigation pane, click Quality rules. On the Quality rules page, click Add quality rule in the upper-right corner or click the
icon and select Add by monitored object.On the Add quality rule page, configure the parameters.
Configure basic information.
Parameter
Description
Rule name
A custom name for the quality rule, up to 256 characters in length. After you select the monitored objects, you can adjust the name for each object individually.
Rule strength
You can select Weak rule or Strong rule.
Weak rule: If you select Weak rule, an alarm is triggered when a quality rule check returns an exception, but downstream task nodes are not blocked.
Strong rule: If you select Strong rule, an exception from a quality rule check triggers an alarm. If downstream tasks exist (such as in code check scheduling or task trigger scheduling), the tasks are also blocked to prevent the spread of contaminated data. If no downstream tasks exist (such as in periodic quality scheduling), only the alarm is triggered.
Description
A custom description for the quality rule, up to 128 characters in length.
Configuration method
You can create rules from a template or by using custom SQL.
From template: Use system templates or custom business templates to quickly create quality rules.
System template: Templates with built-in, configurable parameters, suitable for creating common rules.
Custom template: Templates with pre-set parameters that do not require configuration, typically used for rules that contain specific business logic.
Custom SQL: Define flexible quality monitoring rules by using SQL. This method is suitable for complex and flexible scenarios.
NoteThis configuration is not applicable to data sources and real-time metatables.
Rule template
Supported rule templates vary by monitored object. For more information about templates, see Template types.
For Dataphin tables and global data tables, supported rule templates include Completeness, Uniqueness, Timeliness, Validity, Consistency, Stability, and Custom SQL.
Completeness: Includes Field null value check and Field empty string check.
Uniqueness: Includes Field uniqueness check, Field group count check, and Field duplicate value count check.
Timeliness: Includes Time function comparison, Single-table time field comparison, and Two-table time field comparison.
Validity: Includes Field format check, Field length check, Field value range check, Code table reference comparison, and Data standard code table reference comparison (requires the data standard module to be enabled).
Consistency: Includes Single-table field value consistency comparison, Single-table field statistical value consistency comparison, Single-field business logic consistency comparison, Two-table field value consistency comparison, Two-table field statistical value consistency comparison, Two-table field business logic consistency comparison, and Cross-source two-table field statistical value consistency comparison.
Stability: Includes Table stability check, Table volatility check, Field stability check, and Field volatility check.
Custom SQL: Includes information for creating rules from a custom SQL template.
For metrics, supported rule templates are Uniqueness and Stability.
Uniqueness: Includes Field group count check and Field duplicate value count check.
Stability: Includes Field stability check and Field volatility check.
For data sources, the supported rule template is Stability.
Connectivity monitoring: Monitors data sources configured in Dataphin and sends alarms for connectivity issues. Such issues, often caused by network changes or incorrect credentials, can lead to task errors.
Table structure change: Monitors and sends alarms for changes in the structure of upstream tables, such as renaming, deleting, or adding fields, which can cause downstream errors. Only some data sources support this rule. For a list of supported data sources, see Dataphin supported data sources.
For real-time metatables, supported rule templates are Consistency and Stability.
Consistency: Includes Real-time and offline comparison and Real-time cross-link comparison.
Stability: Includes Real-time statistical value check.
Rule type
The rule type is an attribute of the template and can be used for filtering and description.
Object filtering
You can filter monitored objects based on different criteria.
Dataphin table: Filter data tables by project (for physical tables) or business category (for logical tables), resource owner, and table type. You can select up to 100 projects or business categories.
Global data table: Filter data tables by data source type, data source, and DB/Schema. For a list of supported data sources, see Dataphin supported data sources.
Metric: Filter metrics by data category and summary logical table.
Data source: Filter data sources by data source type.
If you select the Connectivity monitoring rule template, you can create quality monitoring rules for all data sources in Dataphin. All supported data sources can be tested for connectivity.
If you select the Table structure change rule template, select the data tables to check based on the DB/Schema. For a list of data sources that support table structure change monitoring, see Dataphin supported data sources.
Real-time metatable: Filter real-time metatables by project.
NoteWhen you create quality rules for global data tables or for monitoring table structure changes in a data source, if the data source cannot connect to the Dataphin cluster, you must first perform metadata collection before you can configure quality monitoring rules. For a list of supported data sources, see Create and manage metadata collection tasks.
Object selection
Field object: For field-level monitoring, first select the data tables to monitor (by table name, owner, or quality owner), and then select the specific fields.
Table object: When the rule template for a data table is Stability/Table stability check or Stability/Table volatility check, or when the rule template for a data source is Stability/Table structure change, you can configure table-level monitoring rules. You can select the data tables to monitor based on table name, table owner, or quality owner.
Click Next.
If you click Cancel, none of the quality rules in this batch are added.
Configure the rule. (This step is not required for data sources. You can proceed to the next step.)
Parameter
Description
Benchmark table
This is the data table selected in the previous step. You configure rule details based on this table's fields. For example, table A has fields
idandname, table B has fieldsidandage, and table C has fieldsnameandage. If you choose Table A (withidandnamefields) as the benchmark table and set the rule to check theidfield, the rule can be applied to Table B (which has anidfield) but not to Table C (which does not).NoteWhen the monitored object is a data table or real-time metatable, and the rule template is complex (meaning it requires other fields besides the check field), you must configure a benchmark table.
When you need to configure comparison fields in batch for different tables with different fields, a benchmark table provides a quick selection method.
Use a benchmark table for batch configuration when the requirements are similar or identical. If the requirements are completely different, an error occurs during verification.
Template configuration
Displays the configuration information for the selected quality rule template. To modify the configuration, see Quality rule templates.
Rule configuration
The rule configuration options vary based on the selected rule template.
For data table rule configuration details, see Data table parameter configuration.
For metric rule configuration details, see Metric rule configuration.
For real-time metatable rule configuration details, see Offline link comparison parameter configuration and Multi-link comparison parameter configuration.
The following are special configurations:
Filter verified table data: This option is disabled by default. If you enable this option, you can configure filter conditions for the verified table, such as partition filters or general data filters. The filter conditions are appended to the check SQL. If the verified table requires partition filtering, we recommend that you configure a partition expression in the scheduling configuration. The check partition then becomes the minimum granularity for quality reports.
When you select the Consistency/Two-table field statistical value consistency comparison or Consistency/Cross-source two-table field statistical value consistency comparison rule template, you can choose whether to enable Filter compared table data. If you enable this option, you can configure filter conditions for the compared table, such as partition filters or general data filters. The filter conditions are appended to the check SQL.
Check configuration
After a data quality rule runs, the system compares the result with the exception check settings. If the result matches the exception criteria, the check fails and triggers subsequent actions, such as alarms.
The available metrics for exception checks depend on the template and its configuration. Multiple conditions can be combined using AND/OR logic. Use fewer than three conditions.
For more information, see Check configuration description.
Archive configuration
This option is disabled by default. If you enable it, you can archive abnormal data to a file or an archiving table. After the quality check, you can download and analyze the archived abnormal data. For more information, see Exception archiving.
NoteException archiving is supported only for Dataphin tables and global data tables.
Business attribute configuration
The input requirements for business attributes are based on the quality rule's attribute configuration. For example, if the rule owner field is set to custom input with a length of 256 characters, you can enter a value of up to 256 characters when creating the quality rule. For more information, see Attribute information.
Quality score configuration
A quality score evaluates the results of quality checks to help you understand your data quality. For configuration details, see Quality score configuration.
NoteThis feature is supported only for Dataphin tables and global data tables.
Click Next.
Configure object details.
Field-level detail configuration
You can view the field check information for the selected data tables and modify the rule name, quality owner, and quality score weight (supported only for Dataphin tables and global data tables). You can also edit the quality rule, delete check objects, and manage quality owners and quality score weights in batches.

Modify quality owner: Quickly modify the quality owner for the selected monitored objects. You can also click Manage quality owners in batches to Append or Modify them.
NoteAfter successful batch creation, the quality owner configured here overwrites the existing owner of any object that is already being monitored.
Append: Adds quality owners from the list of users and user groups to the current list of quality owners.
Modify: Replaces all quality owners in the current list with the specified users and user groups.
Modify quality score weight: Quickly configure the quality score weight for the quality rule, which is used to calculate the quality score of the monitored object. You can enter an integer from 1 to 10.
Edit: Modifies the rule configuration, check configuration, business attribute configuration, and quality score configuration of the rule.
Delete: Deletes the check object.
Table-level detail configuration
You can view the check information for the selected data tables and modify the rule name, quality owner, and quality score weight (supported only for Dataphin tables and global data tables). You can also edit the quality rule, delete check objects, and manage quality owners and quality score weights in batches. The operations for table-level configuration are the same as for field-level configuration. For more information, see Field-level detail configuration.

Click Add rule to complete the configuration.
List of batch-added quality rules
We recommend enabling a quality rule only after it passes a trial run.
After you create quality rules in batch, you can edit them, perform a trial run, configure scheduling, and delete them from this list.

Area | Description |
① Filter and search area | You can search for rules by object or rule name. You can also filter quality rules by status, such as Trial run failed, Not trial run, Inactive, or Scheduling not configured. |
② List area | Displays the Object name, Rule name, Associated data table/Data category, Trial run status, Effective status, Quality owner, and Scheduling type for each rule. Effective status: We recommend performing a trial run before enabling a rule. Enable the effective status for rules that pass the trial run to prevent incorrect rule configurations from blocking production tasks.
|
③ Operations area | You can perform the following operations: View, Edit, Scheduling configuration, Trial run, Transfer quality owner, and Delete.
|
④ Batch operations area |
|
What to do next
After you configure scheduling in the Quality Rules list and click Done, you can view the rules on the monitored object list page. For more information, see View the list of monitored objects.