This document describes how to use Knowledge Catalog (formerly Dataplex Universal Catalog) data quality scans to measure, monitor, and manage the quality of your data. Data quality scans help you automate the process of validating your data for completeness, validity, and consistency.
With data quality scans, you can define rules to check for missing values, ensure values match a regular expression or belong to a set, verify uniqueness, or use custom SQL for more complex validations such as anomaly detection. This document explains how to create and manage data quality scans.
Learn more about data quality scans. Learn more about reusing data quality rules across multiple scans.
Before you begin
-
Enable the Dataplex API.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles. - Optional: To generate recommendations for data quality rules based on the results of a data profile scan, create and run the data profile scan.
Required roles and permissions
This section describes the IAM roles and permissions needed to use Knowledge Catalog data quality scans.
User roles and permissions
To get the permissions that you need to run and manage data quality scans, ask your administrator to grant you the following IAM roles:
-
Run a data quality scan on a BigQuery table:
- BigQuery Job User (
roles/bigquery.jobUser) on the project to run scan jobs - BigQuery Data Viewer (
roles/bigquery.dataViewer) on the BigQuery table to be scanned
- BigQuery Job User (
-
Publish data quality scan results to Knowledge Catalog:
- BigQuery Data Editor (
roles/bigquery.dataEditor) on the scanned table - Dataplex Catalog Editor (
roles/dataplex.catalogEditor) on the@bigqueryentry group in the same location as the table
- BigQuery Data Editor (
-
Perform specific tasks on
DataScanresources:- Dataplex DataScan Administrator (
roles/dataplex.dataScanAdmin) on the project for full access - Dataplex DataScan Creator (
roles/dataplex.dataScanCreator) on the project to create scans - Dataplex DataScan Editor (
roles/dataplex.dataScanEditor) on the project for write access - Dataplex DataScan Viewer (
roles/dataplex.dataScanViewer) on the project to read scan metadata - Dataplex DataScan DataViewer (
roles/dataplex.dataScanDataViewer) on the project to read scan data including rules and results
- Dataplex DataScan Administrator (
For more information about granting roles, see Manage access to projects, folders, and organizations.
These predefined roles contain the permissions required to run and manage data quality scans. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to run and manage data quality scans:
-
Run a data quality scan on a BigQuery table:
-
bigquery.jobs.createon the project to run scan jobs -
bigquery.tables.geton the BigQuery table to be scanned -
bigquery.tables.getDataon the BigQuery table to be scanned
-
-
Publish data quality scan results to Knowledge Catalog:
-
bigquery.tables.updateon the scanned table -
dataplex.entryGroups.useDataQualityScorecardAspecton the@bigqueryentry group in the same location as the table
-
-
Create a
DataScan:dataplex.datascans.createon the project -
Delete a
DataScan:dataplex.datascans.deleteon the project -
View
DataScanmetadata:dataplex.datascans.geton the project -
View
DataScandetails including rules and results:dataplex.datascans.getDataon the project -
List
DataScans:dataplex.datascans.liston the project -
Run a
DataScan:dataplex.datascans.runon the project -
Update a
DataScan:dataplex.datascans.updateon the project -
Get or set IAM policy on a
DataScan:-
dataplex.datascans.getIamPolicyon the project -
dataplex.datascans.setIamPolicyon the project
-
You might also be able to get these permissions with custom roles or other predefined roles.
If you need to access columns protected by BigQuery column-level access policies, then you also need permissions for those columns.
Knowledge Catalog service account roles and permissions
If you haven't created any data quality or data profile scans or you
don't have a Knowledge Catalog lake in this project, create a
service identifier by running:
gcloud beta services identity create --service=dataplex.googleapis.com.
This command returns a Knowledge Catalog service identifier if it exists.
To ensure that the Knowledge Catalog service account of the project containing the data quality scan has the necessary permissions to read data from various sources and export results, ask your administrator to grant the following IAM roles to the Knowledge Catalog service account of the project containing the data quality scan:
-
Read BigQuery table data:
BigQuery Data Viewer (
roles/bigquery.dataViewer) on BigQuery tables to be scanned and any other tables referenced in rules -
Read Iceberg REST Catalog table data:
BigLake Viewer (
roles/biglake.viewer) on Iceberg REST Catalog tables to be scanned and any other tables referenced in rules -
Export scan results to a BigQuery table:
BigQuery Data Editor (
roles/bigquery.dataEditor) on the results dataset and table -
Scan BigQuery data organized in a Knowledge Catalog lake:
- Dataplex Metadata Reader (
roles/dataplex.metadataReader) on Dataplex resources - Dataplex Viewer (
roles/dataplex.viewer) on Dataplex resources
- Dataplex Metadata Reader (
-
Scan a BigQuery external table from Cloud Storage:
Storage Object Viewer (
roles/storage.objectViewer) on the Cloud Storage bucket
For more information about granting roles, see Manage access to projects, folders, and organizations.
These predefined roles contain the permissions required to read data from various sources and export results. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to read data from various sources and export results:
-
Read BigQuery table data:
-
bigquery.tables.geton BigQuery tables -
bigquery.tables.getDataon BigQuery tables
-
-
Export scan results to a BigQuery table:
-
bigquery.datasets.geton results dataset and table -
bigquery.tables.createon results dataset and table -
bigquery.tables.geton results dataset and table -
bigquery.tables.getDataon results dataset and table -
bigquery.tables.updateon results dataset and table
-