Data modeling
This topic addresses common questions about data modeling.
Which compute resources are supported for logical table quality rules?
What is the difference between strong and soft rules for logical table data quality?
Which compute resources are supported for logical table quality rules?
Currently, the supported compute resources include MaxCompute, Hive, ApsaraDB for RDS, DataHub, PostgreSQL, AnalyticDB for PostgreSQL, and Kafka.
What types of logical table quality rules are available?
The main types are table rules, field rules, and custom SQL rules.
Rule type | Description |
|---|---|
Table row count | Retrieves the row count of the current partition. |
Storage size | Compares the physical storage size of the partition with an expected value. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Primary key uniqueness | Checks if the count of unique primary key values in a partition equals the total number of records in that partition. The rule passes if the counts are equal. |
Multi-table record count fluctuation | Compares the row count of a source table partition with the row count of a target table partition to calculate the fluctuation rate. This rate is then compared with an expected threshold. The rule passes if the comparison is true. The formula for fluctuation rate is: [(Row count of the current source partition - Row count of the specified comparison partition) / Row count of the current source partition] × 100%. The comparison uses the absolute value by default. |
Data completeness rate | Compares the ratio of non-null values in selected fields to the total number of records in a partition with a static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Data uniqueness | Compares the ratio of unique values in selected fields to the total number of records in a partition with a static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Configuration item | Description |
|---|---|
Maximum | Compares the maximum value of the field in a partition with an expected static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Minimum | Compares the minimum value of the field in a partition with an expected static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Average value | Compares the average value of the field in a partition with an expected static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Sum | Compares the sum of the field values in a partition with an expected static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Unique value | Compares the count of unique values in a partition with an expected static number. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Uniqueness rate | Compares the ratio of unique values to the total number of rows in a partition with a static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Duplicate values | Calculates the number of duplicate values by subtracting the count of unique values from the total number of rows in a partition. This count is then compared with an expected static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Duplication rate | Compares the ratio of duplicate values to the total number of rows in a partition with an expected static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Null value count | Compares the number of null values in the field for a partition with an expected static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Percentage of null values | Compares the ratio of null values to the total number of rows in a partition with an expected static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Discrete value group count | Groups the field by discrete values in a partition. Compares the count of each discrete value with an expected static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Discrete value status | Groups the field by discrete values in a partition. Compares the total number of discrete values with an expected static field. The rule passes if the comparison is true. Comparison operators include >, <=, >=, <=, =, and !=. |
Field value length accuracy check | Compares the length of each field value in a partition with an expected static field. The rule passes if all values meet the condition. The default comparison operator is <=. |
Field type accuracy check | Compares the field's data type from the metadata with an expected type. The rule passes if they match. |
Standard dictionary value check | Compares the field values in a partition with the value codes in the corresponding data dictionary. The rule passes if all field values exist in the data dictionary's value codes. |
Custom SQL for a single table: This rule compares the return value of a custom SQL statement with an expected value. You can use this rule for scenarios that are not supported by the default table and field rules.
NoteThe SELECT statement can return only a single value from one row and one column.
Custom SQL for multiple tables: This rule performs calculations on the return values from custom SQL statements for the current logical table and other associated logical tables. The result is then compared with an expected value. For example, you can perform basic operations on the return value for the current table (${result_1}) and the return value for an associated table (${result_2}). You can also use the `abs` function to obtain the absolute value. For example: `(${result_1}+5*abs(${result_1}-${result_2}))/2`
What is the difference between strong and soft rules for logical table data quality?
Strong rule: If the actual result does not satisfy the rule, the data quality is marked as poor.
Soft rule: If the actual result does not satisfy the rule, the data quality is marked as fair.