Auto data quality in Knowledge Catalog (formerly Dataplex Universal Catalog) lets you validate your
BigQuery, Iceberg REST Catalog, SAP Business Data Cloud Delta Lake,
and Apache Hive tables against defined rules. You can automate scans, measure
quality scores, and log alerts when records don't meet your requirements to
help maintain the integrity of data production pipelines. To identify
statistical characteristics of your tables and generate rule recommendations,
see [About data profiling](https://docs.cloud.google.com/knowledge-catalog/docs/data-profiling-overview.md.txt).

## When to use auto data quality

The following are some common use cases:

- **Automate data validation across pipelines**: automatically validate data arriving in your BigQuery and Iceberg REST Catalog tables against predefined or custom rules to prevent corrupt data from reaching downstream analytics.
- **Establish proactive monitoring and alerting**: trigger automated alerts in Cloud Logging when data fails to meet specified quality thresholds to help your data engineering team resolve anomalies quickly.
- **Scale governance with reusable templates**: share standard business rules, such as null checks or uniqueness expectations, across multiple data scans by using rule templates to reduce duplicate effort.
- **Manage data quality policies as code**: define and deploy the quality rules using code to enforce standardized data governance and simplify version control across enterprise data assets.
- **Monitor data integrity trends**: review overall and dimension-level data quality scores, such as completeness and validity, over time to demonstrate compliance with internal data SLAs.

## Conceptual model

![A data quality scan applies quality rules to table data to report results.](https://docs.cloud.google.com/static/knowledge-catalog/images/data-quality-scan.png "Data quality scan")

A data quality scan is a type of [Knowledge Catalog data
scan](https://docs.cloud.google.com/knowledge-catalog/docs/reference/rest/v1/projects.locations.dataScans) that
validates your data against a set of built-in rules. A data scan is a
Knowledge Catalog job that samples data from BigQuery and
Cloud Storage (through BigQuery external tables) and infers
various types of metadata. To measure the
quality of a table using auto data quality, you create a `DataScan` object of
type `data quality`. The scan runs on only one BigQuery table.
The scan uses resources in a Google [tenant
project](https://docs.cloud.google.com/service-infrastructure/docs/glossary#tenant), so you don't need to set
up your own infrastructure.

Creating and using a data quality scan consists of the following steps:

1. Define data quality rules
2. Configure rule execution
3. Analyze data quality scan results
4. Set up monitoring and alerting
5. Troubleshoot data quality failures

You can [manage data quality rules and deployments as
code](https://docs.cloud.google.com/knowledge-catalog/docs/manage-data-quality-rules-as-code) and use
integrated Knowledge Catalog monitoring, troubleshooting, and
Cloud Logging alerting across your scans.

## Rule definition

Data quality rules associated with a data quality scan define data
expectations. You can create data quality rules in the following ways:

- Use rule recommendations generated by a [Knowledge Catalog data profile
  scan](https://docs.cloud.google.com/knowledge-catalog/docs/data-profiling-overview)
- Use the built-in rules or [system rule templates](https://docs.cloud.google.com/knowledge-catalog/docs/reuse-data-quality-rules.md.txt#system-templates)
- Create custom SQL rules
- [Reuse data quality rules](https://docs.cloud.google.com/knowledge-catalog/docs/auto-data-quality-overview.md.txt#reuse-rules)

### Built-in rules

Knowledge Catalog supports the following categories of built-in rules:

Row-level

:   For row-level category rules, the expectation is applied
    against each data row. Each row independently passes or
    fails the condition. For example, `column_A_value < 1`.

    Row-level checks require you to specify a passing threshold. When the
    percentage of rows passing the rule falls below the threshold value, the rule
    fails.

Aggregate

:   For aggregate rules, the expectation is
    applied against a single value aggregated across the entire data. For
    example, `Avg(someCol) >= 10`. To pass, the check must evaluate to the
    boolean `true`. Aggregate rules don't provide an independent pass or fail
    count for each row.

For both of the rule categories, you can set the following parameters:

- The column to which the rule applies
- A [dimension](https://docs.cloud.google.com/knowledge-catalog/docs/auto-data-quality-overview.md.txt#dimensions)

The following table lists the supported row-level and aggregate rule types:

| Rule type (Name in Google Cloud console) | Row-level or aggregate rule | Description | Supported column types | Rule-specific parameters |
|---|---|---|---|---|
| `RangeExpectation` (**Range Check**) | Row-level | Check if the value is between min and max. | All numeric, date, and timestamp type columns. | **Required:** - Passing threshold percentage - `min` or `max` values: specify at least one value. **Optional:** - Enable `strict min`: if enabled, the rule check uses "\>" instead of "\>=". - Enable `strict max`: if enabled, the rule check uses "\<" instead of "\<=". - Enable `ignore null`: if enabled, null values are ignored in the rule check. |
| `NonNullExpectation` (**Null check**) | Row-level | Validate that column values are not NULL. | All supported column types. | **Required:** - Passing threshold percentage. |
| `SetExpectation` (**Set check**) | Row-level | Check if the values in a column are one of the specified values in a set. | All supported column types, except `Record` and `Struct`. | **Required:** - Set of string values to check against. - Passing threshold percentage. **Optional:** - Enable `ignore null`: if enabled, null values are ignored in the rule check. |
| `RegexExpectation` (**Regular expression check**) | Row-level | Check the values against a specified regular expression. | String | **Required:** - Regular expression pattern used to check. - Passing threshold percentage. - Note: GoogleSQL provides regular expression support using the [re2](https://github.com/google/re2/wiki/Syntax) library. See that documentation for its regular expression syntax. **Optional:** - Enable `ignore null`: if enabled, null values are ignored in the rule check. |
| `Uniqueness` (**Uniqueness Check**) | Aggregate | Check if all the values in a column are unique. | All supported column types, except `Record` and `Struct`. | **Required:** - Column and dimension from the supported parameters. **Optional:** - Enable `ignore null`: if enabled, null values are ignored in the rule check. |
| `StatisticRangeExpectation` (**Statistic check**) | Aggregate | Check if the given statistical measure matches the range expectation. | All supported numeric column types. | **Required:** - `mean`, `min`, or `max` values: specify at least one value. **Optional:** - Enable `strict min`: if enabled, the rule check uses "\>" instead of "\>=". - Enable `strict max`: if enabled, the rule check uses "\<" instead of "\<=". |

### Supported custom SQL rule types

SQL rules provide flexibility to expand the validation with custom logic. These
rules come in the following types.

| Rule type | Row-level or aggregate rule | Description | Supported column types | Rule-specific parameters | Example |
|---|---|---|---|---|---|
| Row condition | Row-level | Specify an expectation for every row by defining a SQL expression in a `WHERE` clause. The SQL expression should evaluate to `true` (pass) or `false` (fail) per row. Knowledge Catalog computes the percentage of rows that pass this expectation and compares this value against the passing threshold percentage to determine the success or failure of the rule. The expression can include a reference to another table, for example, to create referential integrity checks. | All columns | **Required:** - SQL condition to use - Passing threshold percentage - Dimension **Optional:** - Column to associate this rule with. | `grossWeight` \<= `netWeight` |
| Table condition (aggregate SQL expression) | Aggregate | These rules are executed once per table. Provide a SQL expression that evaluates to boolean `true` (pass) or `false` (fail). The SQL expression can include a reference to another table using [expression subqueries](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/subqueries.md.txt#expression_subquery_concepts). | All columns | **Required:** - SQL condition to use - Dimension **Optional:** - Column to associate this rule with | Simple aggregate example: `avg(price) > 100` Using an expression subquery to compare values across a different table: ``(SELECT COUNT(*) FROM `example_project.example_dataset.different-table`) < COUNT(*)`` |
| SQL assertion | Aggregate | An assertion rule uses a data quality query to find rows that fail one or more conditions specified in the query. Provide a SQL statement that is evaluated to return rows that match the invalid state. If the query returns any rows, the rule fails. Omit the trailing semicolon from the SQL statement. The SQL statement can include a reference to another table using [expression subqueries](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/subqueries.md.txt#expression_subquery_concepts). | All columns | **Required:** - SQL statement to check invalid state - Dimension **Optional:** - Column to associate this rule with. | Simple aggregate example to make sure that `discount_pct` is not greater than 100: `SELECT * FROM example_project.example_dataset.table WHERE discount_pct > 100` Using an expression subquery to compare values across a different table: ``SELECT * FROM `example_project.example_dataset.different-table` WHERE gross_weight > (SELECT avg(gross_weight) FROM `example_project.example_dataset.different-table`)`` |

For example rules, see [auto data quality sample rules](https://docs.cloud.google.com/knowledge-catalog/docs/use-auto-data-quality.md.txt#sample-rules).

For SQL functions supported, see [GoogleSQL reference](https://docs.cloud.google.com/bigquery/docs/introduction-sql.md.txt).

### Reuse data quality rules

You can reuse Knowledge Catalog data quality rules to share complex or
standardized business rule definitions across multiple data quality rules by
using rule templates. For example, you can create a rule template for an email
validation or for foreign key validation between two tables, and then
reuse those templates across your data scans.

Rule reusability provides the following key features:

- **Data quality rule templates** : create custom rule templates to store complex or standardized business rule definitions that can be shared across multiple data quality rules. Create a `data-quality-rule-template` entry and add a `data-quality-rule-template` aspect to it to define the template logic.
- **Data rules as metadata** : declare data quality rules as aspects in Knowledge Catalog on entries such as BigQuery tables or business glossary terms. Use the `data-rules` aspect type to attach these rules to entries.
- **System rule templates**: use system rule templates for commonly used rules.

For more information, see
[Reuse data quality rules](https://docs.cloud.google.com/knowledge-catalog/docs/reuse-data-quality-rules.md.txt).

### Dimensions

A dimension is a category used to measure a specific aspect of data quality,
such as completeness or validity. Associating rules with dimensions lets you
group scan results for monitoring and alerting. For example, instead of tracking
individual rule failures in isolation, you can monitor an overall completeness
score across a table.

You must associate every data quality rule with a dimension.
Knowledge Catalog provides the following predefined dimensions:

Freshness
:   Measures when the data was last updated or whether it's recent enough
    to be useful. Freshness checks evaluate time intervals or timestamps to verify
    that data pipelines deliver data on schedule. For example, you can use a custom
    SQL rule or the `freshness_expectation` system rule template to verify that the
    latest timestamp in an events table is within the last 24 hours.

Volume
:   Measures the quantity or amount of data, verifying that the expected volume
    of records is present. Volume checks evaluate dataset size using metrics such as
    total row count to detect missing data batches, incomplete ingestion runs, or
    unexpected truncations. For example, you can use a table condition to verify
    that a daily ingestion table contains at least 100,000 rows
    (`COUNT(*) >= 100000`), or compare the row count of a destination table against
    a source table.

Completeness
:   Assesses whether all required data fields contain values without unexpected
    missing or null entries. Completeness checks evaluate whether attributes within
    records are populated. For example, you can use a null check
    (`NonNullExpectation`) to verify that mandatory columns such as `customer_id` or
    `order_date` don't contain null values.

Validity
:   Evaluates whether data conforms to predefined technical standards, formats,
    schemas, or valid value ranges. For example, you can use a regular expression
    check (`RegexExpectation`) to verify that email addresses follow a valid
    format, or a range check (`RangeExpectation`) to verify that a discount
    percentage is between 0 and 100. You can also use a set check
    (`SetExpectation`) to verify that order status values match an allowed list,
    such as `('PENDING', 'SHIPPED', 'DELIVERED')`.

Consistency
:   Evaluates whether data values and relationships agree without contradiction
    across multiple tables, columns, or systems. For example, you can use a custom
    SQL rule to verify referential integrity between an `orders` table and a
    `customers` table, or verify that `gross_weight >= net_weight` within each row.
    You can also verify that total sales revenue reported in a daily summary table
    equals the sum of line items in a transactions table.

Accuracy
:   Reflects the correctness of the data and whether it truthfully represents
    real-world entities or authoritative reference values. You can evaluate
    accuracy by cross-referencing records with authoritative external data sources
    or checking real-world business rules, such as verifying that a transaction
    timestamp isn't in the future.

Uniqueness
:   Measures whether data values are distinct and free from unintended duplicate
    records. For example, you can use a uniqueness check (`UniquenessExpectation`)
    to verify that a primary key or identifier column such as `transaction_id`
    contains only unique values.

> [!NOTE]
> **Note:** When you use the Google Cloud CLI or the REST API to create a data scan, you can specify a custom dimension name that reflects your organization's terminology. Custom dimension names must use only uppercase letters (`A-Z`) and contain at most 30 characters. For example, instead of `FRESHNESS`, you might specify `TIMELINESS`.

#### Distinguish between similar dimensions

When you define data quality rules, some dimensions might seem similar. Use the
following guidelines to select the appropriate dimension:

- **Completeness versus volume** :
  - *Completeness* evaluates whether fields *within* records are populated, such as checking whether a column contains null or missing values.
  - *Volume* evaluates the *overall quantity of records* in the dataset, such as checking the total row count for a table or partition to verify that all expected rows loaded.
- **Completeness versus validity** :
  - *Completeness* evaluates whether a required value is *present* (not null), such as verifying that an `email` column is populated.
  - *Validity* evaluates whether a present value *conforms to an expected
    format, range, or set* , such as verifying that a non-null `email` value matches a valid email pattern rather than a placeholder string such as `'N/A'`.
- **Validity versus accuracy** :
  - *Validity* evaluates whether data conforms to structural rules, syntax, acceptable ranges, or formats, such as checking whether a phone number contains 10 digits.
  - *Accuracy* evaluates whether data reflects real-world truth or authoritative reality, such as checking whether that phone number belongs to the customer. Data can be valid without being accurate.
- **Consistency versus accuracy** :
  - *Consistency* evaluates whether data matches across different systems, tables, or records, such as verifying that a customer's status is the same in both the billing and customer service databases.
  - *Accuracy* evaluates whether data matches the real-world state. Data can be consistent across multiple systems while remaining inaccurate if both systems contain the wrong value.

### Typed input in rules

All value parameters are passed as string values to the API.
Knowledge Catalog requires inputs to follow the
[BigQuery specified format](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/lexical.md.txt#literals).

Binary-typed parameters can be passed as a base64-encoded string.

| Type | Supported formats | Examples |
|---|---|---|
| Binary | Base64 encoded value | YXBwbGU= |
| Timestamp | YYYY-\[M\]M-\[D\]D\[( \|T)\[H\]H:\[M\]M:\[S\]S\[.F\]\] \[time_zone\] OR YYYY-\[M\]M-\[D\]D\[( \|T)\[H\]H:\[M\]M:\[S\]S\[.F\]\]\[time_zone_offset\] | 2014-09-27 12:30:00.45-08 |
| Date | YYYY-M\[M\]-D\[D\] | 2014-09-27 |
| Time | \[H\]H:\[M\]M:\[S\]S\[.DDDDDD\] | 12:30:00.45 |
| DateTime | YYYY-\[M\]M-\[D\]D \[\[H\]H:\[M\]M:\[S\]S\[.DDDDDD\]\] | 2014-09-27 12:30:00.45 |

### Data reference parameter

When you create a custom SQL rule, you can refer to a data source table and all
of its precondition filters by using the data reference parameter `${data()}` in
the rule, instead of explicitly mentioning the source table and its filters.
Knowledge Catalog interprets the parameter as a reference to the source
table and its filters. Examples of precondition filters include
[row filters](https://docs.cloud.google.com/knowledge-catalog/docs/auto-data-quality-overview.md.txt#filtering),
sampling percents, and incremental filters.

For example, say that you have a data source table called
`my_project_id.dim_dataset.dim_currency`. You want to run an incremental data
quality scan that scans only on new daily data. A row filter that filters for
today's entries, `transaction_timestamp >= current_date()`, is applied on the
table.

A custom SQL rule to find rows with `discount_pct` for today looks like this:

    discount_pct IN (SELECT discount_pct FROM my_project_id.dim_dataset.dim_currency WHERE transaction_timestamp >= current_date())

If you use the data reference parameter, you can simplify the rule. Replace the
mention of the table and its precondition filters with the `${data()}`
parameter:

    discount_pct IN (SELECT discount_pct FROM ${data()})

Knowledge Catalog interprets the `${data()}` parameter as a
reference to the data source table with today's entries,
`my_project_id.dim_dataset.dim_currency WHERE transaction_timestamp >= current_date()`.
In this example, the data reference parameter refers only to the incremental
data.

The `${data()}` parameter is case sensitive.

When you use an alias within a subquery to refer to columns in the source table,
either use the data reference parameter to refer to the source table, or omit
the table reference. Don't refer to the columns in the source table by using a
direct table reference in the `WHERE` clause.

Recommended:

- Use the data reference parameter to refer to the source table:

      discount_pct IN (
      SELECT discount_pct FROM
      `my_project_id.dim_dataset.dim_currency` AS temp-table
      WHERE
      temp-table.transaction_timestamp = ${data()}.timestamp
      )

- Omit the table reference:

      discount_pct IN (
      SELECT discount_pct FROM
      `another_project.another_dataset.another_table` AS temp-table
      WHERE
      temp-table.transaction_timestamp = timestamp

Not recommended:

- Don't use a direct table reference to refer to columns in the source table:

      discount_pct IN (
      SELECT discount_pct FROM
      `my_project_id.dim_dataset.dim_currency` AS temp-table
      WHERE
      temp-table.transaction_timestamp = `my_project_id.dim_dataset.dim_currency`.timestamp
      )

Valid use of different tables:

- You can use a direct table reference when comparing columns from a
  *different* table:

      discount_pct IN (
      SELECT discount_pct FROM
      `my_project_id.dim_dataset.dim_currency` AS temp-table
      WHERE
      temp-table.transaction_timestamp = `another_project.another_dataset.another_table`.timestamp
      )

### Debug queries

> [!WARNING]
>
> **Preview**
>
>
> This product or feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section
> of the [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA products and features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

When you create a rule, you can optionally include a debug query to run
alongside the rule. A debug query is a SQL statement that returns up to 10
scalar values. These values can help diagnose the cause if the rule fails. You
can add at most one debug query per rule, and it must not exceed 1024 characters
in length.

Consider the following SQL assertion rule on the
`example_project.example_dataset.table` table that checks whether the average
revenue per item exceeds 100:

```sql
SELECT
  *
FROM
  `example_project.example_dataset.table`
WHERE
  SUM(revenue) / COUNT(DISTINCT item_id) > 100
```

If the preceding rule fails, you can view metrics such as total revenue,
number of distinct items, and average revenue per item to help diagnose the
issue. The following debug query returns these metrics:

```sql
SELECT
  SUM(revenue),
  COUNT(DISTINCT item_id),
  SUM(revenue) / COUNT(DISTINCT item_id)
FROM `example_project.example_dataset.table`
```

## Rule execution

You can schedule data quality scans to run at a specific interval, or you can
run a scan on demand.

### Execution identity

By default, Knowledge Catalog uses a centralized service agent (`service-PROJECT_NUMBER@gcp-sa-dataplex.iam.gserviceaccount.com`) to run data
quality scans.

You can override this default execution identity by specifying a custom service
account or by using your own End-User Credentials (EUC). This provides several
benefits:

- **Principle of least privilege**: grant only the exact IAM permissions required for specific data quality tasks to a dedicated service account, minimizing overprovisioned access.
- **Fine-grained access control**: scope permissions to specific resources, allowing integration with row-level and column-level access policies in BigQuery.
- **Improved auditability**: assign custom service accounts or user credentials to specific scans, making tracking and logging of activities much clearer in audit logs.
- **Billing unification**: when you use a custom execution identity, the processing and storage charges are centralized directly under BigQuery (bypassing Knowledge Catalog Premium SKUs). This lets you take advantage of BigQuery enterprise discounts and slot commitments.

For instructions on how to configure a custom execution identity, see
[Configure execution identity](https://docs.cloud.google.com/knowledge-catalog/docs/use-auto-data-quality.md.txt#configure-execution-identity).

### Networking requirements

To run a scan, you must enable
[Private Google Access](https://docs.cloud.google.com/vpc/docs/configure-private-google-access.md.txt#config-pga)
on the [VPC subnet](https://docs.cloud.google.com/vpc/docs/subnets.md.txt) that you use
for the scan. If you don't specify a subnet, make sure your default subnet has
Private Google Access enabled.

When you run a data quality scan, Knowledge Catalog creates a job. If a
job is misconfigured or running longer than expected, you can
[cancel the job](https://docs.cloud.google.com/knowledge-catalog/docs/use-auto-data-quality.md.txt#cancel-job).

As part of the specification of a data quality scan, you can specify the scope
of a job to be one of the following:

Full Table
:   Each job validates the entire table.

Incremental
:   Each job validates incremental data. To determine increments, provide a
    `Date` / `Timestamp` column in the table that can be used as a marker.
    Typically, this is the column on which the table is partitioned.

### Filter data

You can filter data to be scanned for data quality by using a
row filter. Creating a row filter lets you focus on data within a specific
time period or specific segment, such as a certain region. Using filters can
reduce the run time and cost. For example, you can filter out data with a timestamp
before a certain date.

### Sample data

You can specify a percentage of records from your data
to sample for running a data quality scan. Creating data quality scans on a
smaller sample of data can reduce the run time and the cost relative to
querying the entire dataset.

### Filter rules

When you run a data quality scan, you can use [AIP-160](https://google.aip.dev/160) filter syntax to selectively execute specific rules. Knowledge Catalog performs filtering on the metadata of the rules defined in the scan or rules attached to the catalog entry through the `data-rules` aspect.

#### Filter syntax

The filter syntax follows AIP-160 guidelines. You can use standard AIP-160 operators (such as `=`, `!=`, `>`, `<`, `=~`) and combine multiple conditions using `AND` or `OR`.

When you use an AIP-160 filter string, do the following:

- **In the Google Cloud console** : enter the filter directly using AIP-160 syntax, for example, `name = "critical_check"`.
- **In an API call** : the filter string is often a value within another JSON string literal. This requires escaping double quotes within the AIP-160 string. For example, `"filter": "name = \"critical_check\""`.

#### Filterable fields

You can filter on most fields available in the rule definition:

- `name`: the display name of the rule.
- `dimension`: the data quality dimension (for example, `VALIDITY`).
- `column`: the name of the column the rule applies to.
- `threshold`: the passing threshold for the rule.
- `ignore_null`: a boolean value. When `true`, `NULL` rows are considered passing.
- `attributes`: custom key-value pairs assigned to the rule.

The following examples show common filter patterns. Numeric and boolean values
aren't quoted.

**Filter by name**

- Match exactly: `name = "critical_check"`
- Match a pattern: `name =~ "temp_.*"`

**Filter by dimension**

- Match a specific dimension: `dimension = "COMPLETENESS"`
- Match multiple dimensions: `dimension = "VALIDITY" OR dimension = "ACCURACY"`

**Filter by column and threshold**

- Match a specific column: `column = "user_id"`
- Match a threshold: `threshold > 0.95`
- Match a range: `threshold >= 0.8 AND threshold < 0.9`

**Filter by ignore_null**

- Match boolean value: `ignore_null = true`

**Filter by custom attributes**

- Check for key presence: `attributes:environment`
- Match key and value: `attributes.environment = "prod"`
- Match using regular expressions: `attributes.tag =~ "prio-.*"`
- Match combinations: `attributes.environment = "prod" AND attributes.criticality = "high"`

## Data quality scan results

The results of your data quality scans are available in Knowledge Catalog
and BigQuery.
You can also review and analyze the scan results by using the following methods:

- **Export results to BigQuery**

  You can export the scan results to a BigQuery table for further
  analysis. To customize reporting, you can connect the BigQuery
  table data to a Looker dashboard. You can build an aggregated report
  by using the same results table across multiple scans.
- **Publish results as Knowledge Catalog metadata**

  You can publish the data quality scan results as
  Knowledge Catalog metadata. The latest results are saved to the
  Knowledge Catalog entry that represents the source table, under the
  `data-quality-scorecard` system aspect type. You can view the results on the
  source table's BigQuery and Knowledge Catalog pages in
  the Google Cloud console, on the **Data quality** tab. You can also retrieve
  the results by using the API.

  <br />

  > [!NOTE]
  > **Note:** If an existing data quality scan published the results to the BigQuery and Knowledge Catalog pages in the Google Cloud console, and you instead want to publish future scan results as Knowledge Catalog metadata, you must edit the scan to re-enable publishing.

  For more information about Knowledge Catalog metadata, see

  [About metadata management in Knowledge Catalog](https://docs.cloud.google.com/knowledge-catalog/docs/metadata-overview.md.txt).
- **Review data quality scores**

  Each scan result provides data quality scores that indicate the percentage of
  rules that passed. The scores are reported at the overall job level, the column
  level (if the rule is evaluated against a column), and the dimension level. Use
  the data quality scores to normalize data quality across tables or columns,
  track trends, and identify data that doesn't meet quality requirements.

For more information, see
[View the data quality scan results](https://docs.cloud.google.com/knowledge-catalog/docs/use-auto-data-quality.md.txt#results).

## Monitoring and alerting

You can monitor and get alerts about data quality scans by using the following
methods:

- **Set alerts in Cloud Logging**

  You can monitor the data quality jobs using the `data_scan` and
  `data_quality_scan_rule_result` logs in the Logs Explorer.

  For each data quality job, the `data_scan` log with the `data_scan_type` field
  set to `DATA_QUALITY` contains the following information:
  - Data source used for the data scan.
  - Job execution details, such as creation time, start time, end time, and job state.
  - Result of the data quality job: pass or fail.
  - Dimension level pass or fail.

  Every succeeded job contains a `data_quality_scan_rule_result`
  log with the following detailed information about each rule in that job:
  - Configuration information, such as rule name, rule type, evaluation type, and dimension.
  - Result information, such as pass or failure, total row count, passing row count, null row count, and evaluated row count.

  The information in the logs is available through the API and
  Google Cloud console. You can use this information to set up alerts. For
  more information, see
  [Set alerts in Logging](https://docs.cloud.google.com/knowledge-catalog/docs/use-auto-data-quality.md.txt#set-alerts).

  > [!NOTE]
  > **Note:** For the latest successful job, this information is also available in the parent data quality scan.

- **Send email notification reports**

  You can send email notification reports to alert people about the status and
  results of a data quality job. Notification reports are available for the
  following scenarios:
  - The data quality score is lower than a specified target score
  - The job failed
  - The job finished

  You configure notification reports when you
  [create a data quality scan](https://docs.cloud.google.com/knowledge-catalog/docs/use-auto-data-quality.md.txt#create-scan).
- **Monitor DCU compute costs in Cloud Billing**

  Data quality scan serverless compute does not emit time-series metrics to
  Cloud Monitoring. To track and attribute Data Quality DCU costs by project,
  scan ID, or table, query Cloud Billing export in BigQuery using
  `goog-dataplex-datascan-*` system labels. For more information, see
  [Monitor and attribute Knowledge Catalog DCU costs with Cloud Billing export](https://docs.cloud.google.com/knowledge-catalog/docs/monitoring.md.txt#monitor-dcu-costs-billing-export).

## Troubleshoot data quality failures

When a [rule](https://docs.cloud.google.com/knowledge-catalog/docs/auto-data-quality-overview.md.txt#rule-definition) execution fails, Knowledge Catalog
provides a query to get the failed records. Run this query to see the records
that didn't match your rule. For more information, see
[Troubleshoot a data quality failure](https://docs.cloud.google.com/knowledge-catalog/docs/use-auto-data-quality.md.txt#troubleshoot-failed-query).

> [!NOTE]
> **Note:** The query returns all of the columns of the table, including the failed column.

## Limitations

- Rule recommendations aren't supported in the gcloud CLI.
- In the Google Cloud console, the choice of dimensions is fixed to one of the seven predefined dimensions.
- The number of rules per data quality scan is limited to 1000.
- Data quality scores that are reported at the column level are supported only in the API.
- You can run data quality rules only on BigQuery, Iceberg REST Catalog tables, SAP Business Data Cloud Delta Lake tables, and Apache Hive tables.

## Pricing

- For more information about pricing, see [Knowledge Catalog pricing](https://cloud.google.com/dataplex/pricing).
- To track and attribute Data Quality scan DCU usage and costs using Cloud Billing export to BigQuery, see [Monitor and attribute Knowledge Catalog DCU costs with Cloud Billing export](https://docs.cloud.google.com/knowledge-catalog/docs/monitoring.md.txt#monitor-dcu-costs-billing-export).

## What's next

- Learn how to [use auto data quality](https://docs.cloud.google.com/knowledge-catalog/docs/use-auto-data-quality.md.txt).
- Learn how to [reuse data quality rules](https://docs.cloud.google.com/knowledge-catalog/docs/reuse-data-quality-rules.md.txt).
- Learn how to [manage your data quality rules as code](https://docs.cloud.google.com/knowledge-catalog/docs/manage-data-quality-rules-as-code.md.txt).
- Follow a tutorial to [build a policy-as-code data quality workflow](https://docs.cloud.google.com/knowledge-catalog/docs/build-policy-as-code-data-quality-workflow.md.txt).
- Learn about the available Terraform resources for data profiling. See the following:
  - [Dataplex data scan resource](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dataplex_datascan) in the Terraform registry.
  - The [Dataplex data scan resource documentation](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/tree/master/modules/dataplex-datascan) on GitHub, which supports YAML-based rule configuration.
- Learn about [data profiling](https://docs.cloud.google.com/knowledge-catalog/docs/data-profiling-overview.md.txt).
- Learn how to [use data profiling](https://docs.cloud.google.com/knowledge-catalog/docs/use-data-profiling.md.txt).