Data quality system table
With system tables for AWS Glue Data Quality, the results of each data quality run are stored in tables that you can query to track which rules fail, on which tables, and how your data changes between runs. The tables hold rule outcomes, profiling statistics, and anomaly observations from Data Quality runs on tables in the AWS Glue Data Catalog or within ETL. They are stored as fully managed tables in Amazon S3 Tables, in Apache Iceberg format. You can query them with Amazon Athena, Amazon Redshift, or any other engine that is compatible with Apache Iceberg.
With these tables, you can do the following.
-
Find the rules that fail most often, and on which tables.
-
Review the anomalies that AWS Glue Data Quality detected.
-
Track a statistic, such as the row count of a table, across runs.
To include Data Quality results from an AWS Glue ETL job or from your Amazon EMR pipelines in system tables, use the Data Quality transform from the required import for your language on AWS Glue version 6.0 and above or Amazon EMR 8.1 and above:
-
Python: import from
awsdataquality.transforms. -
Scala: import
software.amazon.dataquality.EvaluateDataQuality.
How AWS Glue Data Quality system tables work
AWS Glue writes rows when a data quality run completes: one row for each rule evaluated, plus profiling statistics and anomaly observations for the run.
Storage location
AWS Glue stores the data in the aws-catalog table bucket in your
account and Region, in the data_quality namespace.
aws-catalog/ # S3 Tables bucket (one per account and Region) +-- data_quality/ # Namespace +-- aws_data_quality_rule_results/ # Table +-- aws_data_quality_profiles/ # Table +-- aws_data_quality_profiles_distributions/ # Table +-- aws_data_quality_observations/ # Table
The following query returns 10 rows from the
aws_data_quality_rule_results table.
SELECT * FROM "s3tablescatalog/aws-catalog"."data_quality"."aws_data_quality_rule_results" LIMIT 10;
Supported system tables
AWS Glue Data Quality has the following system tables:
-
aws_data_quality_rule_results: one row for each rule evaluated in a data quality run. -
aws_data_quality_profilesprovides profiling statistics for each run, such asRowCountandCompleteness. -
aws_data_quality_profiles_distributionsprovides histogram bins for each profiled column. -
aws_data_quality_observationsprovides anomaly detection results: predicted bounds, actual value, and outcome.
The four tables aren't created when you enable system tables for data quality. Each table appears the first time a data quality evaluation run produces a result that will be recorded in the respective tables. For example, the first time you execute a data quality evaluation with a distribution analyzers is when the distributions table will get created.
Enabling system tables
For the permissions, encryption, and status checks that all Data Catalog system tables share, see Use AWS Glue Data Catalog system tables. To turn on the data quality system table, see Turning system tables on and off.
Data Quality exports need no additional key policy statements. If either service
principal statement is missing from your KMS key policy, enabling export still succeeds
and DataQuality.S3TablesExportState.Status stays ENABLED, but
no results are written, and the Data Quality runs that produced them still succeed.
Results produced while the key policy is missing are not exported automatically after
you correct it; new results export normally from that point. Data Quality retains the
unwritten results for 14 days, so if you need them exported, contact AWS Support within
that period after correcting the key policy.
Table schemas
The following sections describe the columns of each Data Quality system table.
aws_data_quality_rule_results
The full name of the table is
"s3tablescatalog/aws-catalog"."data_quality"."aws_data_quality_rule_results".
It is partitioned by identity(evaluation_context),
identity(platform), and day(stored_time).
The aws_data_quality_rule_results system table contains one row for
each rule evaluated in a data quality run. rule_result contains an
outcome such as PASS, FAIL, or ERROR.
evaluated_metrics records the metrics used for that evaluation.
The following table describes the columns of the
aws_data_quality_rule_results table.
| Column | Type | Required | Description |
|---|---|---|---|
schema_version |
string |
No | Version identifier for this row's field set |
evaluation_context |
string |
Yes | Logical identity of the data asset being evaluated. Primary source-level anchor for the DQ result. |
platform |
string |
Yes | Compute or execution platform that produced the DQ result. |
dimensions |
map<string,string> |
No | Platform-specific execution identifiers and context metadata. |
dq_result_id |
string |
Yes | Unique identifier for the DQ result event. |
run_id |
string |
Yes | Platform run identifier. For ETL this is typically job run ID; for EMR, run ID; for catalog-managed runs, DQ run ID. |
cluster_id |
string |
No | Cluster identifier for EMR-based executions; null for platforms that do not expose a cluster identity. |
job_name |
string |
No | Job name for ETL-based executions; null for other platforms. |
rule_name |
string |
No | Canonical rule type or rule label evaluated for this result row. |
rule_description |
string |
No | Human-readable rule expression or rule definition evaluated. |
rule_result |
string |
No | Rule evaluation outcome, for example PASS, FAIL, or ERROR. |
evaluation_message |
string |
No | Evaluation message or failure reason returned for the rule. |
evaluated_rule |
string |
No | Concrete evaluated rule expression after parameter resolution. |
evaluated_metrics |
map<string,double> |
No | Metric name to metric value map used to evaluate the rule. |
labels |
map<string,string> |
No | Additional publisher-defined labels for filtering and grouping. |
evaluation_level |
string |
No | Scope of the evaluated statistic or rule, for example dataset, column, or multi-column scope. |
columns_referenced |
list<string> |
No | Ordered list of columns referenced by the rule or underlying evaluated statistic. |
column_name |
string |
No | Populate only for single-column rules; leave null for dataset-level or multi-column rules. |
catalog_id |
string |
No | Catalog identifier for the evaluated table when available. |
database_name |
string |
No | Database name for the evaluated table when available. |
table_name |
string |
No | Table name for the evaluated table when available. |
ruleset_name |
string |
Yes | Name of the ruleset associated with the rule result. |
descriptors |
map<string,string> |
No | Additional execution or configuration metadata emitted by the publisher. |
execution_role_arn |
string |
No | IAM role used to execute the DQ |
evaluation_run_mode |
string |
No | Identifier for origin of DQ run, for example on-demand run or via an evaluation configuration |
data_quality_evaluation_config |
string |
No | Name of the Data Quality evaluation configuration when the data quality run initiates due to an evaluation configuration |
account_id |
string |
No | AWS account associated with the DQ run. |
region_name |
string |
No | AWS region in which the DQ result was produced. |
started_time |
timestamptz |
No | Execution start timestamp for the DQ run. |
completed_time |
timestamptz |
No | Execution completion timestamp for the DQ run. |
stored_time |
timestamptz |
Yes | Timestamp at which the record was written to the system table. |
aws_data_quality_profiles
The full name of the table is
"s3tablescatalog/aws-catalog"."data_quality"."aws_data_quality_profiles".
It is partitioned by identity(evaluation_context),
identity(platform), and day(stored_time).
One row describes one profiling statistic per run, such as RowCount
and Completeness. statistic_name identifies the statistic,
statistic_value holds its numeric value, and
referenced_datasets identifies additional dataset aliases when
applicable.
The following table describes the columns of the
aws_data_quality_profiles table.
| Column | Type | Required | Description |
|---|---|---|---|
schema_version |
string |
No | Version identifier for this row's field set |
evaluation_context |
string |
Yes | Logical identity of the data asset being evaluated. Primary source-level anchor for the profiling result. |
platform |
string |
Yes | Compute or execution platform that produced the profiling result. |
profile_id |
string |
Yes | Identifier for the generated data profile associated with this profiling run. |
dq_result_id |
string |
Yes | Unique identifier for the DQ result event associated with this profile row. |
dimensions |
map<string,string> |
No | Platform-specific execution identifiers and context metadata. |
run_id |
string |
Yes | Platform run identifier associated with the profiling result. |
cluster_id |
string |
No | Cluster identifier for EMR-based executions; null for platforms that do not expose a cluster identity. |
job_name |
string |
No | Job name for ETL-based executions; null for other platforms. |
statistic_id |
string |
No | Unique identifier of the published statistic. |
statistic_name |
string |
No | Canonical name of the published statistic, for example RowCount or Completeness. |
statistic_value |
double |
No | Numeric value of the published profiling statistic. |
evaluation_level |
string |
No | Scope of the statistic, for example dataset, column, or multi-column scope. |
columns_referenced |
list<string> |
No | Ordered list of columns referenced by the statistic. |
column_name |
string |
No | Populate only for single-column statistics; leave null for dataset-level or multi-column statistics. |
referenced_datasets |
list<string> |
No | Ordered list of referenced dataset aliases when the statistic depends on additional datasets. |
statistic_properties |
map<string,string> |
No | Additional statistic attributes and publisher-defined metadata for the profiling row. |
catalog_id |
string |
No | Catalog identifier for the evaluated table when available. |
database_name |
string |
No | Database name for the evaluated table when available. |
table_name |
string |
No | Table name for the evaluated table when available. |
ruleset_name |
string |
Yes | Name of the ruleset associated with the profiling result when applicable. |
descriptors |
map<string,string> |
No | Additional execution or configuration metadata emitted by the publisher. |
execution_role_arn |
string |
No | IAM role used to execute the DQ |
evaluation_run_mode |
string |
No | Identifier for origin of DQ run, for example on-demand run or via an evaluation configuration |
data_quality_evaluation_config |
string |
No | Name of the Data Quality evaluation configuration when the data quality run initiates due to an evaluation configuration |
account_id |
string |
No | AWS account associated with the profiling run. |
region_name |
string |
No | AWS region in which the profiling result was produced. |
started_time |
timestamptz |
No | Execution start timestamp for the profiling run. |
completed_time |
timestamptz |
No | Execution completion timestamp for the profiling run. |
stored_time |
timestamptz |
Yes | Timestamp at which the record was written to the system table. |
aws_data_quality_profiles_distributions
The full name of the table is
"s3tablescatalog/aws-catalog"."data_quality"."aws_data_quality_profiles_distributions".
It is partitioned by identity(evaluation_context),
identity(platform), and day(stored_time).
One row describes one distribution bin for each profiled column. Numeric bins use
bin_lower_bound and bin_upper_bound; categorical bins use
bin_label.
The following table describes the columns of the
aws_data_quality_profiles_distributions table.
| Column | Type | Required | Description |
|---|---|---|---|
schema_version |
string |
No | Version identifier for this row's field set |
evaluation_context |
string |
Yes | Logical identity of the data asset being evaluated. Primary source-level anchor for the distribution result. |
platform |
string |
Yes | Compute or execution platform that produced the distribution result. |
run_id |
string |
Yes | Platform run identifier associated with the profiling result. |
cluster_id |
string |
No | Cluster identifier for EMR-based executions; null for platforms that do not expose a cluster identity. |
job_name |
string |
No | Job name for ETL-based executions; null for other platforms. |
profile_id |
string |
Yes | Identifier for the generated data profile associated with this distribution row. |
dq_result_id |
string |
Yes | Unique identifier for the DQ result event associated with this distribution row. |
dimensions |
map<string,string> |
No | Platform-specific execution identifiers and context metadata. |
statistic_id |
string |
No | Unique identifier of the distribution statistic whose bin is represented by this row. |
column_name |
string |
No | Populate only for single-column distribution statistics; leave null for dataset-level or multi-column statistics. |
data_type |
string |
No | Data type of the profiled values represented by the distribution. |
num_bins |
int |
No | Total number of bins emitted for the distribution statistic. |
bin_index |
int |
No | Zero-based bin position within the distribution. |
bin_label |
string |
No | Label for categorical bins; null for numeric distributions. |
bin_lower_bound |
string |
No | Lower boundary for numeric bins; null for categorical distributions. |
bin_upper_bound |
string |
No | Upper boundary for numeric bins; null for categorical distributions. |
bin_count |
long |
No | Count of records that fall into the represented bin. |
evaluation_level |
string |
No | Scope of the statistic, for example dataset, column, or multi-column scope. |
columns_referenced |
list<string> |
No | Ordered list of columns referenced by the distribution statistic. |
catalog_id |
string |
No | Catalog identifier for the evaluated table when available. |
database_name |
string |
No | Database name for the evaluated table when available. |
table_name |
string |
No | Table name for the evaluated table when available. |
ruleset_name |
string |
Yes | Name of the ruleset associated with the distribution result when applicable. |
descriptors |
map<string,string> |
No | Additional execution or configuration metadata emitted by the publisher. |
execution_role_arn |
string |
No | IAM role used to execute the DQ |
evaluation_run_mode |
string |
No | Identifier for origin of DQ run, for example on-demand run or via an evaluation configuration |
data_quality_evaluation_config |
string |
No | Name of the Data Quality evaluation configuration when the data quality run initiates due to an evaluation configuration |
account_id |
string |
No | AWS account associated with the distribution run. |
region_name |
string |
No | AWS region in which the distribution result was produced. |
started_time |
timestamptz |
No | Execution start timestamp for the distribution run. |
completed_time |
timestamptz |
No | Execution completion timestamp for the distribution run. |
stored_time |
timestamptz |
Yes | Timestamp at which the record was written to the system table. |
aws_data_quality_observations
The full name of the table is
"s3tablescatalog/aws-catalog"."data_quality"."aws_data_quality_observations".
It is partitioned by identity(evaluation_context),
identity(platform), and day(stored_time).
One row describes one observed statistic generated by anomaly detection. The
predicted range is in lower_bound and upper_bound. Compare
actual_value with expected_value and use
prediction_outcome and observation_message to interpret
the result.
The following table describes the columns of the
aws_data_quality_observations table.
| Column | Type | Required | Description |
|---|---|---|---|
schema_version |
string |
No | Version identifier for this row's field set |
evaluation_context |
string |
Yes | Logical identity of the data asset being evaluated. Primary source-level anchor for the observation result. |
platform |
string |
Yes | Compute or execution platform that produced the observation result. |
run_id |
string |
Yes | Platform run identifier associated with the profiling result. |
cluster_id |
string |
No | Cluster identifier for EMR-based executions; null for platforms that do not expose a cluster identity. |
job_name |
string |
No | Job name for ETL-based executions; null for other platforms. |
dq_result_id |
string |
Yes | Unique identifier for the DQ result event associated with this observation row. |
dimensions |
map<string,string> |
No | Platform-specific execution identifiers and context metadata. |
statistic_id |
string |
No | Unique identifier of the statistic evaluated for anomaly detection. |
statistic_name |
string |
No | Canonical name of the statistic evaluated for anomaly detection. |
lower_bound |
double |
No | Lower predicted bound for the statistic. |
upper_bound |
double |
No | Upper predicted bound for the statistic. |
expected_value |
double |
No | Expected value predicted for the statistic. |
actual_value |
double |
No | Actual observed value of the statistic. |
recommended_rules |
list<string> |
No | Recommended DQ rules generated from the observation result. |
observation_message |
string |
No | Human-readable anomaly or observation message for the statistic. |
training_input |
string |
No | Indicates whether the statistic was included or excluded from model training. |
training_status |
string |
No | Training status or eligibility state for anomaly detection on the statistic. |
prediction_outcome |
string |
No | Prediction outcome for the statistic, for example ANOMALY, NOT_ANOMALY, or SKIPPED. |
observation_mode |
string |
No | Observation generation mode, for example FIXED or SCHEDULED. |
evaluation_level |
string |
No | Scope of the statistic, for example dataset, column, or multi-column scope. |
columns_referenced |
list<string> |
No | Ordered list of columns referenced by the observed statistic. |
column_name |
string |
No | Populate only for single-column statistics; leave null for dataset-level or multi-column statistics. |
catalog_id |
string |
No | Catalog identifier for the evaluated table when available. |
database_name |
string |
No | Database name for the evaluated table when available. |
table_name |
string |
No | Table name for the evaluated table when available. |
descriptors |
map<string,string> |
No | Additional execution or configuration metadata emitted by the publisher. |
execution_role_arn |
string |
No | IAM role used to execute the DQ |
evaluation_run_mode |
string |
No | Identifier for origin of DQ run, for example on-demand run or via an evaluation configuration |
data_quality_evaluation_config |
string |
No | Name of the Data Quality evaluation configuration when the data quality run initiates due to an evaluation configuration |
account_id |
string |
No | AWS account associated with the observation run. |
region_name |
string |
No | AWS region in which the observation result was produced. |
started_time |
timestamptz |
No | Execution start timestamp for the observation run. |
completed_time |
timestamptz |
No | Execution completion timestamp for the observation run. |
stored_time |
timestamptz |
Yes | Timestamp at which the record was written to the system table. |
Querying Data Quality system tables
To query Data Quality system tables, integrate the aws-catalog S3 Tables
bucket with the AWS Glue Data Catalog before querying it. See
Integrating with Amazon S3 Tables. Readers need access to the Glue Data Catalog
and the required Data Quality tables through IAM or AWS Lake Formation. Data Quality
results can contain rule expressions, evaluation messages, table identifiers, and other
information that you should share only with intended readers.
Example queries
The following example queries show common ways to use the Data Quality system tables.
Rules that failed most often in the last 7 days
SELECT database_name, table_name, rule_name, count(*) AS failures FROM "s3tablescatalog/aws-catalog"."data_quality"."aws_data_quality_rule_results" WHERE rule_result = 'FAIL' AND completed_time >= current_timestamp - interval '7' day GROUP BY 1, 2, 3 ORDER BY failures DESC;
In this query, replace my-database and my-table with your
own values.
Row count of a table across runs
SELECT completed_time, statistic_value AS row_count FROM "s3tablescatalog/aws-catalog"."data_quality"."aws_data_quality_profiles" WHERE statistic_name = 'RowCount' AND database_name = 'my-database' AND table_name = 'my-table' ORDER BY completed_time;
Anomalies detected in the last 7 days
SELECT database_name, table_name, statistic_name, actual_value, lower_bound, upper_bound, observation_message, completed_time FROM "s3tablescatalog/aws-catalog"."data_quality"."aws_data_quality_observations" WHERE prediction_outcome = 'ANOMALY' AND completed_time >= current_timestamp - interval '7' day ORDER BY completed_time DESC;