Create a Dataphin table quality rule

Updated at:

In Dataphin, you can create quality rules for tables to simplify quality monitoring. This topic explains how to configure these rules.

Prerequisites

You must add a monitored object before you can configure quality rules. For instructions, see Add a monitored object or Add and manage monitored objects.

Permissions

  • Super administrators, quality administrators, users with a custom global role granted the Quality Rule-Management permission, and users with a custom project role granted the Project Quality Management-Quality Rule Management permission for the table's project can configure scheduling, alerts, an exception archive table, scoring weights, and runtime configurations for quality rules.

  • Quality owners can configure scheduling, alerts, an exception archive table, scoring weights, and runtime configurations for quality rules on their monitored objects.

  • Quality owners and regular users also require read permission on Dataphin tables. To apply for this permission, see Apply for, Renew, and Revoke Table Permissions.

  • Operation permissions vary by object. For more information, see Operation Permissions for Quality Rules.

Quality rule configuration

You can configure quality rules in two ways: custom configuration or monitoring by referencing data standards (requires enabling the data standard module).

  • Custom configuration lets you quickly create rules from built-in or custom quality rule templates. It also supports custom SQL for flexible monitoring.

  • Monitoring by referencing data standards applies the quality rules from the data standard mapped to the current asset object. This ensures consistency with the data standard.

Validation rules

When validating a data table against quality rules, if a weak monitoring rule is triggered, the system sends you an alert. If a strong monitoring rule is triggered, the system automatically interrupts the task to prevent dirty data from flowing downstream and also sends you an alert.

Test run vs. run

A test run and a run differ in their execution method and where their results are displayed. A test run is a simulated execution of a quality rule to verify that it works as expected; the results of a test run do not appear in the quality report. A run checks the quality rule within a specified time window, and its results appear in the quality report for review and analysis.

Quality rule configuration

  1. In the Dataphin console, choose Governance > Data Quality from the top navigation bar.

  2. In the left-side navigation pane, click Quality Rule. On the Dataphin Table page, click the name of the target object to go to the Quality Rule Details page to configure the quality rule.

    • Custom configuration

      1. Hover over the data table and choose Create Quality Rule > Custom Configuration, or click Create Quality Rule to open the Create Quality Rule dialog box.

      2. In the Create Quality Rule dialog box, configure the parameters.

        Parameter

        Description

        Basic information

        Rule name

        A custom name for the quality rule. The name can be up to 256 characters long.

        Rule strength

        You can select a weak rule or a strong rule.

        • Weak rule: If you select a weak rule, the system sends an alert but does not block downstream task nodes when the quality check fails.

        • Strong rule: If you select a strong rule and a quality check fails, the system sends an alert and blocks downstream tasks (in code check scheduling or task-triggered scheduling) to prevent data contamination from spreading. If there are no downstream tasks (for example, in periodic quality scheduling), only an alert is sent.

        Description

        A custom description for the quality rule. The description can be up to 128 characters long.

        Configuration method

        • Create from template: Quickly create a quality rule by using a built-in system template or a custom business template.

          • System template: The template contains configurable built-in parameters and is suitable for creating general-purpose rules.

          • Custom template: The template has preset parameters that do not require configuration. This is typically used for creating rules that contain business logic.

        • Custom SQL: Define a flexible quality monitoring rule by using SQL. This method is suitable for flexible and complex scenarios.

        Rule template

        Select a rule template from the drop-down list. Options include integrity, uniqueness, timeliness, validity, consistency, stability, and custom SQL.

        • Integrity: 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, Reference code comparison, and Data standard reference code comparison (requires the data standard module).

        • Consistency: Includes Single-table field value consistency comparison, Single-table field statistic consistency comparison, Single-field business logic consistency comparison, Two-table field value consistency comparison, Two-table field statistic consistency comparison, Two-table field business logic consistency comparison, and Cross-source two-table field statistic consistency comparison.

        • Stability: Includes Table stability check, Table fluctuation check, Field stability check, and Field fluctuation check.

        • Custom SQL: Includes Custom statistical metric check and Custom data detail check.

        For more information, see Template type descriptions.

        Rule type

        The rule type is associated with the template and serves as its most basic attribute. It can be used for descriptions and filtering.

        Monitoring granularity

        When the configuration method is custom SQL, you can configure the monitoring granularity. You can select Full table or a specific field to monitor.

        Template configuration

        Template information

        When you select a quality rule template, its configuration information is displayed. To modify the configuration, go to Quality rule templates.

        Rule configuration

        Rule configuration

        The rule configuration parameters vary depending on the selected rule template. For more information, see Data table parameter configuration.

        The following special configurations are available:

        • Filter verification table data: This option is disabled by default. When enabled, you can configure filter conditions for the verification table, such as by partition or other data filters. The filter condition is appended directly to the verification SQL. If you need to filter the verification table by partition, configure a partition expression in the scheduling settings. This allows you to view the quality report at the finest granularity of the verified partition.

        • When you select the Consistency/Two-table field statistic consistency comparison or Consistency/Cross-source two-table field statistic consistency comparison rule template, you can enable Filter comparison table data. This allows you to set filter conditions for the comparison table, such as by partition or other data filters. The filter condition is appended directly to the verification SQL.

        Grouped statistics configuration

        Grouped statistics

        You can configure this option if grouped statistics are enabled in the verification results configuration and the rule is a custom data detail check rule. This option lets you group and count the verification results of the current rule. If an applicable rule includes the current rule, this switch is enabled and locked by default but can be modified in the verification results configuration. Otherwise, you can enable it manually.

        Grouped statistics SQL

        This option is configurable after you enable grouped statistics. Write SQL to count the total and anomalous rows for each group based on the grouping field. You can click Generate SQL draft to generate a draft based on the total row count SQL and anomalous row count SQL you entered. Verify the statistical logic and then save the draft.

        Note
        • The query scope of the grouped statistics SQL must match the data range of the total row count SQL. The anomaly condition must also match that of the anomalous row count SQL.

        • You can generate a draft only if the total row count SQL or the anomalous row count SQL is provided.

        Verification configuration

        Rule verification

        • After a data quality rule is verified, the system compares the result with the anomaly check configuration. If the conditions are met, the verification fails and triggers subsequent processes such as alerts.

        • The metrics available for anomaly checks depend on the template and configuration. Multiple AND/OR conditions are supported, but use fewer than three conditions.

        For more information, see Verification configuration description.

        Archive configuration

        Anomaly archiving

        This option is Off by default. When On, you can archive anomalous data to a file or table. After a quality check, you can download and analyze the archived anomalous data.

        • Archive mode supports Archive only anomalous fields and Archive full records.

          • Archive only anomalous fields: Archives only the currently monitored field after deduplication. This mode is suitable for cases where anomalous data can be fully identified by a single field.

          • Archive full records: Archives the entire record containing the anomalous data. This mode is suitable for cases where the full record is required to locate the anomalous data.

            Note

            Because archiving full records significantly increases the archived data volume, use the "Archive only anomalous fields" mode in most cases.

        • Archive location supports Default file server and Custom anomaly archive table. If an anomaly archive table has not been created, click Manage anomaly archive tables to create one. For more information, see Add an anomaly archive table.

          • Default file server: Refers to the system file server configured during Dataphin deployment. You can download the anomalous data archived from each check on the verification record page. When using the default file server, the system archives a maximum of 100 anomalous records per check, which is suitable for scenarios with small data volumes.

          • Custom anomaly archive table: If you want to store more anomalous data or consolidate data from different checks for later analysis, specify a custom archive table. Each quality rule can record up to 10,000 anomalous records per run. In addition to downloading data from a single check on the verification record page, you can also access the archive table directly and customize its lifecycle for greater flexibility.

            Note
            • You can download a consolidated set of anomalous data generated by all rules in the current run. The download contains a maximum of 10,000 records. To view more data, archive it to a specified anomaly archive table and access the table directly.

            • The anomaly archive table must meet specific format requirements to avoid write errors during use. For more information, see Add an anomaly archive table.

        Business attribute configuration

        Attribute information

        The specifications for business attributes depend on how you configure the quality rule attributes. For example, if the value type for the "Managing Department" field is set to Enum (Multi-select) with the options "Big Data Dept," "Business Dept," and "Tech Dept," then when you create a quality rule, this attribute appears as a multi-select drop-down list with those options.

        If the value type for the "Rule Owner" field is set to Custom Input with a length limit of 256 characters, you can enter up to 256 characters for this attribute when creating a quality rule.

        If the input method for an attribute is Range, configure it as follows:

        Range: Typically used for continuous numerical or date ranges. You can choose from four operators: >, >=, <, and <=. For more information on attribute configuration, see Create and manage quality rule attributes.

        Scheduling attribute configuration

        Scheduling method

        Select a configured scheduling method. If you have not decided on a method, you can configure it after creating the quality rule. To create a new method, see Create a schedule.

        Quality score configuration

        Scoring method

        Two scoring methods are supported: quality check status and data pass rate.

        • Quality check status: This method bases scores on the status of the rule's most recent successful verification record. A pass receives 100 points, and a failure receives 0 points.

        • Data pass rate: The score is the percentage of valid data (the pass rate) from the rule's most recent successful verification record. For example, if the data format validity is 80%, the quality score is 80.

        Supported scoring methods vary by rule template. The following templates only support the Quality check status method:

        • From the Uniqueness category: Field group count check and Field duplicate value count check.

        • From the Consistency category: Single-table field statistic consistency comparison and Cross-source two-table field statistic consistency comparison.

        • The entire Stability category.

        • From the Custom SQL category: Custom statistical metric check.

        Quality score weight

        The weight of the quality rule's score, used to calculate the overall quality score of the monitored object. You can select an integer from 1 to 10.

      3. Click OK to finish configuring the custom rule.

        You can click Preview SQL to compare the current configuration with the last saved version and review SQL changes.

        Note
        • The Preview SQL button is unavailable if key information is missing.

        • The left pane shows the SQL preview of the last saved configuration. If you have not saved a configuration, the pane is empty. The right pane shows the preview of the current configuration.

  • Reference a data standard for monitoring

    1. Hover over the data table and choose Create Quality Rule > Reference Data Standard for Monitoring.

    2. In the Reference Data Standard for Monitoring dialog box, select the data standard rules that you want to reference. You can filter standard rules by templates such as validity, uniqueness, integrity, and stability, or search by object name.

      In this dialog box, you can modify the rule name and enable or disable it. You can also click the standard code under Associated Standard to view standard details, or click the image icon in the Actions column to view the quality rule.

      Note

      After you reference a rule, you cannot modify its configuration details. However, you can configure its scheduling, rule strength, and other settings.

    3. Click Add selected rules to finish referencing the data standard rules.

Rule configuration list

After you create a quality rule, you can view, edit, perform a trial run, run, delete, and perform other operations in the rule configuration list.

image

Area

Description

① Filter and search

Quickly search by object or rule name.

Filter by rule type, rule template, rule strength, trial run status, status, and rule source.

Note

If you configure a quality rule attribute as searchable or filterable and enable it, you can search or filter by that attribute.

② List

This area displays the object type/name, rule name/ID, trial run status, status, rule type, rule template, rule strength, scheduling type, related knowledge base documents, and last updater/time. Click the image icon before the refresh button to select the fields to display in the rule list.

  • If you are referencing a data standard rule, click the image icon next to the rule name to view the standard details.

  • If it is a standard constraint for a development field, a image icon appears next to the rule name.

  • Status: Perform a trial run before you enable a rule. Enable only the rules that pass the trial run to avoid blocking production tasks with incorrect rules.

    • When enabled, the selected rule runs automatically according to its configured schedule.

    • When disabled, the selected rule does not run automatically, but you can run it manually.

  • Related knowledge base documents: Click View details to see the knowledge base information associated with the rule. This includes the table name, verification object, rule, and related documents. You can also search for, view, edit, and delete knowledge base articles. For more information, see View a knowledge base.

③ Actions

Actions include viewing, cloning, editing, performing a trial run, running, configuring scheduling, associating knowledge base documents, configuring a quality score, and deleting rules.

  • View: View the rule configuration details.

  • Clone: Quickly copy a rule.

  • Edit: After you edit a rule, you must perform a trial run again. The editable information varies depending on the feature that generated the quality rule. For more information, see Quality rule editing instructions.

  • Trial run: Perform a trial run for the rule by using an Existing schedule or a Custom verification scope. After the trial run, click the image icon to view the trial run log.

  • Run: Run the rule by using an Existing schedule or a Custom verification scope. After the run, you can view the results in the verification record.

  • Scheduling configuration: In the dialog box, you can filter by scheduling type or search by schedule name. You can also edit the schedule.

  • Associate knowledge base document: After you associate a rule with a knowledge base article, the association is visible in the Quality Rule module and the governance workbench. You can select an unassociated knowledge base article. To create one, see Create and manage a knowledge base.

  • Quality score configuration: Modify the scoring method and quality score weight of the quality rule.

    Important

    The quality score weight is used to calculate the overall quality score of the monitored object. Modifying it will affect the quality score results. Proceed with caution.

  • Delete: Deleting this quality rule object deletes all quality rules under it. This action cannot be undone. Proceed with caution.

④ Bulk actions

You can perform bulk operations, including trial run, run, configure scheduling, enable, disable, modify business attributes, associate knowledge base documents, configure quality scores, export rules, and delete.

  • Trial run: Run a bulk trial run for rules by using an Existing schedule or a Custom verification scope. After the trial run, click the image icon to view the trial run log.

  • Run: Run rules in bulk by using an Existing schedule or a Custom verification scope. After the run, you can view the results in the verification record.

    Note

    When running rules in bulk, select tables with the same partition. The system passes the partition information directly to the execution engine. If partitions do not match, an error may occur.

  • Configure scheduling: In the dialog box, filter by scheduling type or search by schedule name to bulk-configure schedules for quality rules. You can only modify selected rules that are editable on the quality rule list page.

  • Enable: After enabling rules in bulk, the selected rules run automatically according to their configured schedules. You can only enable selected rules that are editable on the quality rule list page.

  • Disable: After disabling rules in bulk, the selected rules will not run automatically, but you can run them manually. You can only disable selected rules that are editable on the quality rule list page.

  • Modify business attributes: When the value type of a business attribute is single-select or multi-select, you can modify it in bulk.

    • If the value type is multi-select, you can append or replace attribute values.

    • If the value type is single-select, you can directly replace the attribute value.

  • Associate knowledge base document: After a rule is associated with a knowledge base article, the association is visible in the Quality Rule module and the governance workbench. You can bulk-associate knowledge base articles with monitored objects. To create an article, see Create and manage a knowledge base.

  • Quality score configuration: Bulk-modify the scoring method and quality score weight for quality rules.

    Important

    The quality score weight is used to calculate the overall quality score of the monitored object. Modifying it will affect the quality score results. Proceed with caution.

  • Export rules: Export selected custom SQL quality rules from the current monitored object. You can only export rules for which you have view permissions.

  • Delete: Bulk-delete quality rule objects. This action cannot be undone. You can only delete rules for which you have edit permissions. Proceed with caution.

Create schedule

Note
  • When you configure a schedule for a rule, you can quickly reuse an existing schedule. Each table can have a maximum of 20 schedule rules.

  • You can configure up to 10 schedules for a single rule.

  • Schedules with identical configurations are automatically deduplicated.

  • If the current table is a Hologres partitioned table, we recommend using a schedule triggered by a specified task.

  • The check range is passed as a filter condition to the quality check statement, defining the scope of data to be checked. It also sets the minimum granularity for downstream features such as quality reports.

  1. On the Quality Rule Details page, click the Scheduling configuration tab, and then click Create schedule to open the Create schedule dialog box.

  2. In the Create schedule dialog box, configure the parameters.

    Parameter

    Description

    Schedule name

    A custom name for the schedule, up to 64 characters long.

    Schedule type

    Supported types: time-based schedule, schedule triggered by data update, and schedule triggered by a specified task.

    • Time-based schedule: Runs periodic quality checks at a specified time. This schedule type is ideal for tables with predictable output times.

      • Scheduling cycle: Running quality rules consumes computing resources. We recommend avoiding the concurrent execution of multiple quality rules to prevent disruptions to production tasks. The available scheduling cycles are Day, Week, Month, Hour, and Minute.

        If the system time zone (in the user center) differs from the schedule's time zone (configured in management center > System Settings > Basic Settings), the rule runs based on the system time zone.

      • Use recommended time: Clicking Use recommended time prompts the system to suggest a time based on the average completion time of the task that generates the current table.

    • Schedule triggered by data update: When any code task runs, the system checks if the task updates the specified check range of the current table. This is suitable for tables with irregular update tasks or for critical tables that require monitoring after every change.

      Note

      Set the check range to the partitions updated by the task. For non-partitioned tables, the entire table is checked. The system automatically detects all data changes to ensure no checks are missed.

    • Schedule triggered by a specified task: Executes the configured quality rule before or after a specified task succeeds. You can select triggering tasks of the following engine types: SQL, offline pipeline, Python, Shell, Virtual, Dlink, and database SQL nodes. This is suitable for tables with fixed update tasks.

      Note
      • You can only select tasks from the production environment to trigger the schedule. If you use a strong rule and the quality check fails, it may affect production tasks. Proceed with caution.

      • Supported engine types include MaxCompute.

      • Trigger: Select when to trigger the quality check. You can choose Trigger after all tasks successfully run, Trigger after each successful run of a task, or Trigger before each run of a task.

      • Triggering task: Users with the following roles can select a task node from a production project as the triggering task. You can search by node output name or select from the Recommended tasks or All tasks lists.

        • Project administrators of Prod/Basic projects, users with the O&M system role for Prod projects, users with the Developer system role for Basic projects, and users with a custom project role that has the Project Quality Management-Quality Rule Management permission for a Prod/Basic project can select task nodes from that production project.

        • Users with a custom global role that has the Quality Rules-Management permission can select task nodes from any production project.

        • Recommended tasks: This list shows lineage tasks where the current table is an output, and tasks where the node output name matches the format PlateName/ProjectName.TableName. This corresponds to the tasks shown in data assets - Asset Details - Output Information.

        • All tasks: This list shows all production tasks for which you have operations permissions.

          Note
          • When the trigger condition is set to trigger after all tasks run successfully, we recommend selecting a trigger task with the same scheduling cycle to avoid delayed rule execution and delayed output of quality check results due to different scheduling cycles.

          • When you set the trigger to run before each run of each task, the system recommends lineage tasks that use the current table as input.

    Scheduling condition

    If enabled, the system verifies the scheduling condition before scheduling the quality rule. The rule runs only if the condition is met; otherwise, the current run is skipped.

    • Business date/Execution date: If the schedule type is time-based schedule (does not support execution date), schedule triggered by data update, or schedule triggered by a specified task, you can configure a date condition. You can choose 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, you can set conditions based on Month, Week, or Date. For example:

        image

      • If you select Custom Calendar, you can set conditions based on Date Type or Tag. For example:

        image

    • Instance type: If the schedule type is schedule triggered by data update or schedule triggered by a specified task, you can configure the instance type. Supported values are scheduled instance, data backfill instance, and manual instance. For example:

      image

    Note
    • You must configure at least one condition. To add a condition, click + Add Condition.

    • You can configure a maximum of 10 scheduling conditions.

    • The relationship between scheduling conditions can be set to AND or OR.

    Check range

    For time-based schedule and schedule triggered by a specified task types, you can select custom check range. For the schedule triggered by data update type, you can select either Partitions updated by the task or custom check range.

    • Partitions updated by the task: If a task updates partitions, the quality check is run on the updated partitions.

      Note
      • In dynamic partition scenarios, the system may fail to identify the partitions, in which case the quality check is not performed.

      • Fluctuation check rules, such as those that check partition size, partition row count, or field statistics, require a specified partition and do not support the "Partitions updated by the task" check range.

      • For non-partitioned tables, any data update triggers a check on the entire table.

    • Custom check range: For scenarios where partitions cannot be automatically identified, you can use a custom check range and specify it with a check range expression based on the business date or execution date.

      • Check range expression: An editable drop-down list. You can enter the desired check range, such as ds='${yyyyMMdd}'. You can also select and modify a built-in partition expression to speed up configuration. For more information about partition expressions, see Built-in partition expression types.

        Note
        • If you have multiple validation conditions, you can connect them by using and or or, such as province="Zhejiang" and ds<=${yyyyMMdd}.

        • If a filter condition is configured in the quality rule, it is combined with the check range expression by using an AND operator. Both conditions are applied during the data check.

        • The check range expression supports a full table scan.

          Note: A full table scan consumes significant resources and is not supported in some cases. Configure a partition expression to avoid full table scans.

      • Check range preview: Defaults to the current business date.

  3. Click OK to complete the scheduling configuration.

Scheduling configuration list

After creating a schedule, you can view, edit, clone, or delete it from the scheduling configuration list.

image

Area

Description

① Filter and search area

Search by schedule name.

Filter by time-based schedule, schedule triggered by data update, or schedule triggered by a specified task.

② List area

Displays the Schedule name, Schedule type, Last modified by, and Last modified time for each scheduling configuration.

③ Actions area

You can edit, clone, or delete a schedule.

  • Edit: Modify a configured schedule.

    Important

    This action updates the configurations of all rules that reference the schedule. Proceed with caution.

  • Clone: Quickly copy a scheduling configuration.

  • Delete: You cannot delete a schedule that is referenced by a rule configuration.

Alarm configuration

You can configure different notification methods for different rules to handle alerts differently. For example, you can configure phone call alerts for anomalies detected by strong rules and SMS alerts for anomalies detected by weak rules. If a rule triggers multiple alarm configurations, you can set an alerting policy to determine which configuration takes effect.

Note

You can create a maximum of 20 alarm configurations for a single monitored object.

  1. On the Alarm Configuration tab, click Create Alarm Configuration to open the Create Alarm Configuration dialog box.

  2. In the Create Alarm Configuration dialog box, configure the parameters.

    Parameter

    Description

    Scope

    Valid values: All Rules, All Strong Rules, All Weak Rules, and Custom.

    Note
    • You can create one alarm configuration per monitored object for each of the following scopes: All Rules, All Strong Rules, and All Weak Rules. New rules are automatically matched to the corresponding alarm configuration based on their strength. To change any of these alarm configurations, you can edit the existing configuration.

    • For the Custom scope, you can select up to 200 existing rules under the current monitored object.

    Alarm configuration name

    The alarm configuration name must be unique within a single monitored object and cannot exceed 256 characters.

    Alarm recipient

    Configure alarm recipients and notification methods. You must select at least one alarm recipient and one notification method.

    • Alarm recipient: You can select custom recipients, an on-call schedule, or the quality owner.

      You can configure up to 5 custom alarm recipients and up to 3 on-call schedules.

    • Notification method: You can select different notification methods, including Phone Call, Email, SMS, DingTalk.

  3. Click OK to complete the alarm configuration.

Alarm configuration list

After you create an alarm configuration, you can sort, edit, or delete it in the alarm configuration list.

image

No.

Description

① Sorting area

Configure an alerting policy for when a quality rule matches multiple alarm configurations:

  • Activate First Matched Configuration: When you select this alerting policy, only the first matching alarm configuration takes effect, and the system ignores all others. This allows you to sort your alarm configurations. Click Sort Rules. You can drag a configuration by using the image.png icon next to its name or use the icons in the Actions column to move it. The icons, from left to right, are Move to Top and Move to Bottom. After reordering, click Finish Sorting.

    image

  • Activate All Matched Configurations: All alarm configurations in the list apply to the quality rules under the current monitored object.

    For example, if you have multiple alarm configurations and select this policy, the system performs alarm aggregation based on the notification method, alarm recipient, and rule. If alerts for a Custom recipient and the quality owner are sent to the same person, the system also aggregates the alert messages.

    Note
    • Alarm aggregation is not supported for an on-call schedule.

    • If the quality owner is a user group, notifications are automatically sent to all members of the group.

② List area

This area displays the name and scope of each alarm configuration, along with its recipients and their assigned notification methods.

Scope: For custom alarm configurations, you can view the names of the configured objects and rules. If a rule is deleted, its name is no longer displayed. We recommend updating the alarm configuration in this case.

image

③ Actions area

You can edit or delete your alarm configurations.

  • Edit: Modify an existing alarm configuration. If you change the alarm recipients or notification methods, be sure to inform the relevant personnel to avoid missing important business alerts.

  • Delete: After you delete an alarm configuration, it no longer applies to its matched rules. Proceed with caution.

Add an exception archive table

An exception archive table archives records that fail quality rule validation.

  1. Click the Exception Archive tab, and then click the + Add Exception Archive Table button to open the Add Exception Archive Table dialog box.

  2. In the Add Exception Archive Table dialog box, configure the parameters.

    • Method: You can either Create a new table or Select an existing table. Special quality validation fields are added to prevent exception data from being written to the original data table.

      • Create a new table: The table name defaults to current_table_name_exception_data. You can also enter a custom name using letters, digits, underscores (_), and periods (.). The name can be up to 128 characters long.

        • If the monitored table is a physical table, the exception archive table is created in the same project.

        • If the monitored table is a dimension logical table or a fact logical table, the exception archive table is created in the same project by default. You can also manually specify a project within the same domain as the monitored table, such as projectA.table_name.

        • If the monitored table is a summary logical table, we recommend that you specify a project name in the same domain for the exception archive table. Otherwise, the system automatically archives the data to a project within the monitored table's domain.

        • If the monitored table is a data source table, the exception archive table is created in the database or data source of the monitored table.

      • Select an existing table: You can select a table from the same project or data source. The table must contain all fields from the monitored table in addition to the required validation fields. You can click View Exception Archive Table DDL to see the required DDL statement.

    • Lifecycle: This setting applies only to tables that use MaxCompute as the compute engine. If you create a new table, you can enter a custom number of days or select a preset option: 7 days, 14 days, 30 days, or 360 days. If you select an existing table, the system displays its configured lifecycle period.

    • Maximum archive count: This setting is only available for tables that use MaxCompute as the compute engine. It defines the maximum number of exception data records you can archive from a single quality rule task execution. If the number of exceptions exceeds this threshold, the system archives only the specified number of records and discards the rest (though you can view them in logs). The default is 10,000 records per check. You can select 10,000, 100,000, 500,000, or All, or enter any positive integer.

      Note
      • A large amount of data in the exception archive table can affect query performance. Configure this setting based on your business scenarios.

      • Whether you create a new table or select an existing table, the table must include the fields defined in the following DDL statement:

        create table current_table_name_exception_data
         (dataphin_quality_tenant_id      varchar(64)   comment 'Tenant ID' , 
          dataphin_quality_rule_id        varchar(64)   comment 'Quality Rule ID', 
          dataphin_quality_rule_name      varchar(256)  comment 'Quality Rule Name', 
          dataphin_quality_column_name    varchar(1024) comment 'Validation Field Name', 
          dataphin_quality_watch_task_id  varchar(128)  comment 'Monitored object task ID', 
          dataphin_quality_rule_task_id   varchar(64)   comment 'Rule Task ID', 
          dataphin_quality_validate_time  varchar(64)   comment 'Quality Validation Time', 
          dataphin_quality_archive_mode   varchar(32)   comment 'Exception archive mode, ONLY_ERROR_FIELD/FULL_RECORD', 
          dataphin_quality_error_data     string        comment 'Exception data', 
          ljba_id                         bigint        comment  'ljba: primary key', 
          ljb_id                          bigint        comment  'ljb: primary key', 
          col_tinyint                     tinyint       comment 'Data type is TINYINT and lowercase',
          col_tinyint_02                  tinyint       comment '2',
          col_smallint                    smallint      comment 'Data type is SMALLINT and lowercase',
          col_smallint_02                 smallint      comment '4',
          col_int                         int           comment 'Data type is INT and lowercase',
          col_int_02                      int           comment '6',
          col_bigint                      bigint        comment 'Data type is BIGINT and lowercase',
          col_bigint_02                   bigint        comment '8',
          col_float                       float         comment 'Data type is FLOAT and lowercase',
          col_float_02                    float         comment '10',
          col_double                      double        comment 'Data type is DOUBLE and lowercase',
          col_double_02                   double        comment '11',
          col_decimal                     decimal(38,18) comment 'Data type is DECIMAL(38,18) and lowercase',
          col_decimal_02                  decimal(38,18) comment '12',
          col_varchar                     varchar(500)   comment 'Data type is VARCHAR(500) and lowercase',
          col_varchar_02                  varchar(500)   comment '13',
          col_char                        char(10)       comment 'Data type is CHAR(10) and lowercase',
          col_char_02                     char(10)       comment '14',
          col_string                      string         comment 'Data type is STRING and lowercase',
          col_string_02                   string         comment '15',
          col_date                        date           comment 'Data type is DATE and lowercase',
          col_date_02                     date           comment '16',
          col_datetime                    datetime       comment 'Data type is DATETIME and lowercase',
          col_datetime_02                 datetime       comment '17',
          col_timestmap                   timestamp      comment 'Data type is TIMESTAMP and lowercase',
          col_timestmap_02                timestamp      comment '18',
          col_boolean                     boolean        comment 'Data type is BOOLEAN and lowercase',
          col_boolean_02                  boolean        comment '19',
          col_binary                      binary         comment 'Data type is BINARY and lowercase',
          col_binary_02                   binary         comment '20',
          col_array                       array<int>     comment 'Data type is ARRAY<int> and lowercase',
          col_array_02                    array<string>  comment '21',
          col_map                         map<string,string>  comment 'Data type is MAP<string, string> and lowercase',
          col_map_02                      map<string,int>     comment '22',
          ds                              string              comment 'Date partition, yyyyMMdd'
         ) 
        partitioned by 
        (dataphin_quality_validate_date string comment 'Validation date (partition field)');
  3. Click OK to add the exception archive table.

    You can select Automatically set as active archive table after creation. This automatically selects the table as the archive location when you create a new quality rule.

Exception archive table list

After you add a table, the first one in the list becomes the default active archive table. Click the name of an exception archive table to view its table structure. You can also set a table as the active archive table, delete it, or edit it.

  • Set as active archive table: When you set a table as the current active archive table, it receives exception data from all quality rules under this monitored object that are configured for a custom archive table.

  • Delete: This action removes only the reference relationship to the exception archive table; it does not delete the physical table itself. You can add the table again later if needed.

  • Edit: This option applies only to tables that use MaxCompute as the compute engine. You can modify the lifecycle and maximum archive count.

Quality report

Click the quality report tab to view the rule check overview and rule check details for the current quality rule.

  • Filter the rule check details by abnormal result, partition time, or keywords in the rule or object name.

  • Click the image icon in the Actions column to view the rule check details.

  • Click the image icon in the Actions column to view the execution log.

Quality rule permission management

  1. On the Permission Management tab, configure the View Details permission to control which members can view validation record details, quality rule details, and quality reports.

    View Details: You can select All members or Only members with quality management permissions for the current object.

  2. Click OK to apply the permission settings.

Verification result configuration

Verification result configuration aggregates rule verification results by specified fields (dimensions) and writes them to a result table. This lets you analyze data quality trends from different business perspectives, such as by department or region.

  1. Click the Verification Result Configuration tab, and then click Edit at the bottom to configure the parameters.

    Parameter

    Description

    Grouped statistics

    Enables or disables grouped statistics. By default, this feature is disabled. When enabled, the system groups and aggregates verification results by the specified fields and writes them to the grouped result table. Click View usage example to see how it works.

    Applicable rules

    Select the quality rules to which grouped statistics applies. You can select All rules or Specified rules.

    • All rules: All quality rules for the current monitored object that support grouped statistics.

    • Specified rules: Select one or more quality rules for the current monitored object that support grouped statistics.

    Note
    • The following rules support verification result configuration:

      • Template creation: Field null value check, field empty string check, field uniqueness check, field format check, field length check, field value range check, code table reference comparison, data standard code table reference comparison, single-table field value consistency comparison, single-table business logic consistency comparison, time function comparison, single-table time field comparison, two-table time field comparison, two-table field value consistency comparison, and two-table business logic consistency comparison.

      • Custom SQL: Custom data details verification.

    • If a custom data verification rule with grouped statistics enabled is not selected as an applicable rule, the system automatically adds it to the specified rules upon saving.

    • For a custom data details verification rule, you can click Edit Grouped Statistics SQL to write the SQL.

    Grouped fields

    Select the fields to use for dimensional aggregation. You can select multiple fields. When multiple fields are selected, statistics are grouped by the combination of their values, for example, group by columnA, columnB.

    Storage location

    The storage location for the grouped verification results. You can select Default file server or Custom result table.

    • Default file server: The system file server configured during Dataphin deployment. You can view the grouped verification records on the Verification Records > Verification Details tab. The default file server displays a maximum of 100 grouped result data entries for each verification run, making it suitable for scenarios with small data volumes.

    • Custom result table: To store a large volume of grouped result data or to consolidate results from different verification runs for analysis, specify a custom result table. Besides viewing records on the Verification Records > Verification Details tab, you can also query the grouped result table directly for more flexibility.

    Grouped result table

    This parameter is required when you set the storage location to a custom result table. This parameter specifies the data table that is used to save grouped validation results. Click Add Grouped Result Table or Modify, and then configure the grouped result table in the Add Grouped Result Table dialog box.

    • For Add Method, you can select new table or existing table.

      • new table: By default, the table name is automatically generated by appending _group_analysis_result to the name of the current monitored table. You can also specify a custom name using letters, digits, underscores (_), and periods (.). The name can be up to 128 characters long.

        • If the monitored table is a physical table, the grouped result table is created in the same project as the monitored table.

        • If the monitored table is a dimension logical table or fact logical table, the grouped result table is created in the same project as the monitored table by default. You can also manually specify a project within the same module as the monitored table, such as projectA.table_name.

        • If the monitored table is a summary logical table, you should specify a project name within the same module for the grouped result table. Otherwise, the table is automatically created in a project within the same module as the monitored table.

        • If the monitored table is a data source table, the grouped result table is created in the database or data source to which the monitored table belongs.

      • existing table: You can only select a table from the same project or data source as the current monitored object. The grouped result table must meet specific format requirements to prevent write errors. You can click View DDL template for table creation to view the required DDL statement.

        Note
        • All applicable rules for the current monitored object share the same custom result table. In each verification run, every statistical metric (such as total count and error count) for a given group is saved as a separate row.

        • The table, whether new or existing, must adhere to the following DDL statement:

          create table group_analysis_result -- Can be changed to a specified name
          (
             dataphin_quality_tenant_id varchar(64) comment 'tenant ID'
          ,
             dataphin_quality_rule_task_id varchar(64) comment 'rule task ID'
          ,
             dataphin_quality_watch_task_id varchar(128) comment 'monitored object'
          ,
             dataphin_quality_rule_id varchar(64) comment 'rule ID'
          ,
             dataphin_quality_rule_name varchar(256) comment 'rule name'
          ,
             dataphin_quality_column_name varchar(1024) comment 'verification field'
          ,
             dataphin_quality_validate_time varchar(64) comment 'verification time'
          ,
             dataphin_quality_validate_date varchar(32) comment 'verification date'
          ,
             total_rows varchar(64) comment 'total rows in group'
          ,
             error_rows varchar(64) comment 'error rows in group'
          ,
             normal_rows varchar(64) comment 'normal rows in group'
          ,
             normal_rate varchar(64) comment 'normal rate in group'
          ,
             error_rate varchar(64) comment 'error rate in group'
          ,
             name varchar(512) comment 'name'
          )
  2. Click OK to complete the verification result configuration.

Quality rule run configuration

Note
  • If a quality rule task times out, the system automatically terminates it and marks it as failed. You can view the corresponding execution log on the validation log details page.

  • For quality rule tasks with retry on failure enabled, you can view the execution log for each retry on the validation log details page.

  • All quality rules for a single monitored object, including new rules and existing rules that have not yet run, follow the latest run configuration.

  1. Click the Run Configurations tab, and then click Edit at the bottom of the page to configure the parameters.

    Parameter

    Description

    Scope

    You can select All Rules, All Strong Rules, All Weak Rules, or Custom.

    Run Timeout

    If the total run time of a quality rule task (excluding time spent waiting for resources or scheduling) exceeds the specified threshold, the system automatically terminates the task and marks it as failed. The default is 1 hour. You can set a custom duration from 0 to 2 hours, with up to two decimal places.

    Automatic Retry on Failure

    For failed quality rule tasks, use Number of Retries and Retry Interval to configure automatic reruns. This feature is disabled by default; enable it to configure these parameters.

    • Number of Retries: The maximum number of times to automatically retry a failed quality rule task. The default is 1. You can set an integer from 1 to 3.

    • Retry Interval: The interval between automatic retries. The default is 0 minutes. You can set an integer from 0 to 10.

  2. Click OK to save the run configuration.

Next steps

After you configure the quality rules, you can view them on the table rule list page in Dataphin. For more information, see or Manage monitored object list.