This document describes how to inspect a BigQuery table for sensitive data and send the inspection results to Knowledge Catalog. This action automatically adds an aspect to the Knowledge Catalog entry that's associated with your BigQuery table.
This document also provides example queries that you can use to find data across your organization and projects with specific aspect values.
This feature is useful if you want to enrich your metadata in Knowledge Catalog with sensitive data classifications from Sensitive Data Protection inspection jobs.
The generated aspects include the following details:
Knowledge Catalog provides a unified inventory of Google Cloud resources.
Knowledge Catalog lets you use aspects to add business and technical metadata to your data to capture context and knowledge about your resources. You can then search and discover data across your organization and enable data governance over your data assets. For more information, see Aspects.
To automatically create Knowledge Catalog aspects based on inspection job results, follow this high-level workflow:
Create or edit an inspection job that inspects a BigQuery table. For instructions, see Inspect a BigQuery table.
In the Add actions step, enable Publish to Dataplex Universal Catalog.
Sensitive Data Protection adds or updates the
Sensitive Data Protection job result aspect of the Knowledge Catalog
entry associated with the
BigQuery table. You can then search
Knowledge Catalog for all data in your organization or project
with specific aspect values. For example queries, see Example search
queries in this document.
The resulting Knowledge Catalog aspect is stored in the same project and region as the BigQuery table.
The Sensitive Data Protection job result aspect has the following fields:
projects/example-project/locations/us/dlpJobs/i-8992079400000000000.0.False.The Dataplex API must be enabled in each project that contains data that you want to add aspects for. This section describes how to enable the Dataplex API in a single project or in all projects in an organization or folder.
Select the project in which you want to enable the Dataplex API.
Enable the Dataplex API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM
role (roles/serviceusage.serviceUsageAdmin), which
contains the serviceusage.services.enable permission. Learn how to grant
roles.
This section provides a script that searches for all projects in an organization or folder and enables the Dataplex API in each of those projects.
To get the permissions that you need to enable the Dataplex API in all projects in an organization or folder, ask your administrator to grant you the following IAM roles:
roles/cloudasset.viewer)
on the organization or folderroles/dlp.user)
on each project in which you want to enable the Dataplex APIFor more information about granting roles, see Manage access to projects, folders, and organizations.
These predefined roles contain the permissions required to enable the Dataplex API in all projects in an organization or folder. To see the exact permissions that are required, expand the Required permissions section:
The following permissions are required to enable the Dataplex API in all projects in an organization or folder:
cloudasset.assets.searchAllResources
on the organization or folder
serviceusage.services.use
on each project in which you want to enable the Dataplex API
You might also be able to get these permissions with custom roles or other predefined roles.
To enable the Dataplex API in all projects in an organization or folder, follow these steps:
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
Run the following script:
#!/bin/bash
RESOURCE_ID="RESOURCE_ID"
gcloud asset search-all-resources \
--scope="RESOURCE_TYPE/$RESOURCE_ID" \
--asset-types="cloudresourcemanager.googleapis.com/Project" \
--format="value(name)" |
while read project_name; do
project_id=$(echo "$project_name" | sed 's|.*/||')
gcloud services enable "dataplex.googleapis.com" --project="$project_id"
done
Replace the following:
RESOURCE_ID: the organization number or folder
number of the resource that contains the projectsRESOURCE_TYPE: the type of the resource that
contains the projects—organizations or foldersTo get the permissions that you need to search for aspects associated with your BigQuery table, ask your administrator to grant you the following IAM roles on the table:
roles/dataplex.catalogViewer)roles/bigquery.dataViewer)For more information about granting roles, see Manage access to projects, folders, and organizations.
These predefined roles contain the permissions required to search for aspects associated with your BigQuery table. To see the exact permissions that are required, expand the Required permissions section:
The following permissions are required to search for aspects associated with your BigQuery table:
dataplex.entries.listdataplex.entries.getbigquery.datasets.getbigquery.tables.getYou might also be able to get these permissions with custom roles or other predefined roles.
For more information about the permissions required to use Knowledge Catalog, see Knowledge Catalog IAM permissions.
You can configure and run a Sensitive Data Protection inspection job by using the Google Cloud console or the DLP API.
In the Google Cloud console, go to the Create job or job trigger page.
The following example sends a
projects.locations.dlpJobs.create
request to inspect a BigQuery table and send the results to
Knowledge Catalog.
Before using any of the request data, make the following replacements:
PROJECT_ID: your Google Cloud project ID. Project IDs are
alphanumeric strings
LOCATION: the region or multi-region where you want to process the
request—for example, europe-west1 or us. For available
locations, see Sensitive Data Protection locations.
BIGQUERY_DATASET_NAME: name of the BigQuery dataset that
contains the table to inspect
BIGQUERY_TABLE_NAME: name of the BigQuery table to
inspect
HTTP method and URL:
POST https://dlp.googleapis.com/v2/projects/PROJECT_ID/locations/LOCATION/dlpJobs
Request JSON body:
{
"inspectJob":
{
"storageConfig":
{
"bigQueryOptions":
{
"tableReference":
{
"projectId": "PROJECT_ID",
"datasetId": "BIGQUERY_DATASET_NAME",
"tableId": "BIGQUERY_TABLE_NAME"
}
}
},
"inspectConfig":
{
"infoTypes":
[
{
"name": "EMAIL_ADDRESS"
},
{
"name": "PERSON_NAME"
},
{
"name": "US_SOCIAL_SECURITY_NUMBER"
},
{
"name": "PHONE_NUMBER"
}
],
"includeQuote": true,
"minLikelihood": "UNLIKELY",
"limits":
{
"maxFindingsPerRequest": 100
}
},
"actions":
[
{
"publishFindingsToDataplexCatalog": {}
}
]
}
}
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{
"name": "projects/PROJECT_ID/locations/LOCATION/dlpJobs/JOB_ID",
"type": "INSPECT_JOB",
"state": "PENDING",
"inspectDetails": {
"requestedOptions": {
"snapshotInspectTemplate": {},
"jobConfig": {
"storageConfig": {
"bigQueryOptions": {
"tableReference": {
"projectId": "PROJECT_ID",
"datasetId": "BIGQUERY_DATASET_NAME",
"tableId": "BIGQUERY_TABLE_NAME"
}
}
},
"inspectConfig": {
"infoTypes": [
{
"name": "EMAIL_ADDRESS"
},
{
"name": "PERSON_NAME"
},
{
"name": "US_SOCIAL_SECURITY_NUMBER"
},
{
"name": "PHONE_NUMBER"
}
],
"minLikelihood": "UNLIKELY",
"limits": {
"maxFindingsPerRequest": 100
},
"includeQuote": true
},
"actions": [
{
"publishFindingsToDataplexCatalog": {}
}
]
}
},
"result": {}
},
"createTime": "2025-09-09T00:29:55.951374Z",
"lastModified": "2025-09-09T00:29:58.022967Z"
}
For information about how to get the inspection job results using the DLP API, see Get a job.
This section provides example search queries that you can use in Knowledge Catalog to find data in your organization or project with specific aspect values.
You can find only the data that you have access to. Data access is controlled through IAM permissions. For more information, see Roles and permissions for viewing aspects in this document.
You can enter these example queries in the Search field on the Knowledge Catalog Search page.
For information about how to form the queries, see Search syntax for Knowledge Catalog.
aspect:sensitive-data-protection-job-result
aspect:sensitive-data-protection-job-result.hasFindings=True
aspect:sensitive-data-protection-job-result.hasFindings=False
The following query returns the entries of tables that Sensitive Data Protection inspected row by row.
aspect:sensitive-data-protection-job-result.isFullScan=True
The following query returns the entries of tables that Sensitive Data Protection inspected through sampling.
aspect:sensitive-data-protection-job-result.isFullScan=False
To migrate a job trigger that is configured to use the deprecated Publish to Data Catalog action, follow these steps:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-06-09 UTC.