Scan for data quality issues

This document explains how to use BigQuery andDataplex Universal Catalog together to ensure that data meets your qualityexpectations. Dataplex Universal Catalog automatic data quality lets you define andmeasure the quality of the data in your BigQuery tables. You canautomate the scanning of data, validate data against defined rules, and logalerts if your data doesn't meet quality requirements.

For more information about automatic data quality, see theAuto data quality overview.

Tip: The steps in this document show how to manage data quality scans acrossyour project. You can also create and manage data quality scans when workingwith a specific table. For more information, see theManage data quality scans for a specific table sectionof this document.

Before you begin

  1. 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 theserviceusage.services.enable permission.Learn how to grant roles.

    Enable the API

  2. Optional: If you want Dataplex Universal Catalog to generate recommendations fordata quality rules based on the results of a data profile scan,create and run the data profile scan.

Required roles

Required data scan roles

To use auto data quality, ask your administrator to grant you one of the followingIAM roles:

The following table lists theDataScan permissions:

Permission nameGrants permission to do the following:
dataplex.datascans.createCreate aDataScan
dataplex.datascans.deleteDelete aDataScan
dataplex.datascans.getView operational metadata such as ID or schedule, but not results and rules
dataplex.datascans.getDataViewDataScan details including rules and results
dataplex.datascans.listListDataScans
dataplex.datascans.runRun aDataScan
dataplex.datascans.updateUpdate the description of aDataScan
dataplex.datascans.getIamPolicyView the current IAM permissions on the scan
dataplex.datascans.setIamPolicySet IAM permissions on the scan

Create a data quality scan

Console

  1. In the Google Cloud console, on the BigQueryMetadata curation page, go to theData profiling & quality tab.

    Go to Data profiling & quality

  2. ClickCreate data quality scan.

  3. In theDefine scan window, fill in the following fields:

    1. Optional: Enter aDisplay name.

    2. Enter anID. See theresource naming conventions.

    3. Optional: Enter aDescription.

    4. In theTable field, clickBrowse. Choose the table to scan, andthen clickSelect.Only standard BigQuery tables aresupported.

      For tables in multi-region datasets, choose a region where to createthe data scan.

      To browse the tables organized within Dataplex Universal Catalog lakes,clickBrowse within Dataplex Lakes.

    5. In theScope field, chooseIncremental orEntire data.

      • If you chooseIncremental: In theTimestamp column field,select a column of typeDATE orTIMESTAMP from yourBigQuery table that increases as new records are added,and that can be used to identify new records. It can be a column thatpartitions the table.
    6. To filter your data, select theFilter rows checkbox. Provide arow filter consisting of a valid SQL expression that can be used as a part of aWHERE clause in GoogleSQL syntax.For example,col1 >= 0.The filter can be a combination of multiple column conditions. Forexample,col1 >= 0 AND col2 < 10.

    7. To sample your data, in theSampling size list, select asampling percentage. Choose a percentage value that ranges between0.0% and 100.0% with up to 3 decimal digits. For largerdatasets, choose a lower sampling percentage. For example, for a1 PB table, if you enter a value between 0.1% and 1.0%,the data quality scan samples between 1-10 TB of data. Forincremental data scans, the data quality scan applies sampling to thelatest increment.

    8. To publish the data quality scan results as Dataplex Universal Catalogmetadata, select thePublish results to Dataplex Catalog checkbox.

      You can view the latest scan results on theData quality tab in theBigQuery and Dataplex Universal Catalog pages for the sourcetable. To enable users to access the published scan results, see theGrant access to data quality scan results sectionof this document.

    9. In theSchedule section, choose one of the following options:

      • Repeat: Run the data quality scan on a schedule: hourly, daily,weekly, monthly, or custom. Specify how often the scan runs andat what time. If you choose custom, usecronformat to specify the schedule.

      • On-demand: Run the data quality scan on demand.

      • One-time: Run the data quality scan once now, and remove thescan after the time-to-live period.

      • Time to live: The time-to-live value is the time span betweenwhen the scan is executed and when the scan is deleted. A dataquality scan without a specified time-to-live is automaticallydeleted 24 hours after its execution. The time-to-live can rangefrom 0 seconds (immediate deletion) to 365 days.

    10. ClickContinue.

  4. In theData quality rules window, define the rules toconfigure for this data quality scan.

    1. ClickAdd rules, and then choose from the following options.

      • Profile based recommendations: Build rules from therecommendations based on an existing data profiling scan.

        1. Choose columns: Select the columns to get recommended rules for.

        2. Choose scan project: If the data profiling scan is in adifferent project than the project where you are creatingthe data quality scan, then select the project to pull profilescans from.

        3. Choose profile results: Select one or more profile results andthen clickOK. This populates a list of suggested rules thatyou can use as a starting point.

        4. Select the checkbox for the rules that you want to add, and thenclickSelect. Once selected, the rules are added to yourcurrent rule list. Then, you can edit the rules.

      • Built-in rule types: Build rules from predefined rules.See the list ofpredefined rules.

        1. Choose columns: Select the columns to select rules for.

        2. Choose rule types: Select the rule types that you want tochoose from, and then clickOK. The rule types that appeardepend on the columns that you selected.

        3. Select the checkbox for the rules that you want to add, and thenclickSelect. Once selected, the rules are added to yourcurrent rules list. Then, you can edit the rules.

      • SQL row check rule: Create a custom SQL rule to apply to each row.

        1. InDimension, choose one dimension.

        2. InPassing threshold, choose a percentage of records that mustpass the check.

        3. InColumn name, choose a column.

        4. In theProvide a SQL expression field, enter a SQL expressionthat evaluates to a booleantrue (pass) orfalse (fail). Formore information, seeSupported custom SQL rule typesand the examples inDefine data quality rules.

        5. ClickAdd.

      • SQL aggregate check rule: Create a custom SQLtable condition rule.

        1. InDimension, choose one dimension.

        2. InColumn name, choose a column.

        3. In theProvide a SQL expression field, enter a SQL expressionthat evaluates to a booleantrue (pass) orfalse (fail). Formore information, seeSupported custom SQL rule typesand the examples inDefine data quality rules.

        4. ClickAdd.

      • SQL assertion rule: Create a custom SQL assertion rule to checkfor an invalid state of the data.

        1. InDimension, choose one dimension.

        2. Optional: InColumn name, choose a column.

        3. In theProvide a SQL statement field, enter a SQL statementthat returns rows that match the invalid state. If any rows arereturned, this rule fails. Omit the trailing semicolon from the SQLstatement. For more information, seeSupported custom SQL rule typesand the examples inDefine data quality rules.

        4. ClickAdd.

    2. Optional: For any data quality rule, you can assign a custom rule nameto use for monitoring and alerting, and a description. To do this,edit a rule and specify the following details:

      • Rule name: Enter a custom rule name with up to 63 characters.The rule name can include letters (a-z, A-Z), digits (0-9), andhyphens (-) and must start with a letter and end with a numberor a letter.
      • Description: Enter a rule description with a maximumlength of 1,024 characters.
    3. Repeat the previous steps to add additional rules to the data qualityscan. When finished, clickContinue.

  5. Optional: Export the scan results to a BigQuery standardtable. In theExport scan results to BigQuery table section, do thefollowing:

    1. In theSelect BigQuery dataset field, clickBrowse. Select aBigQuery dataset to store the data quality scan results.

    2. In theBigQuery table field, specify the table to store the dataquality scan results. If you're using an existing table, make surethat it is compatible with theexport table schema.If the specified table doesn't exist, Dataplex Universal Catalog createsit for you.

      Note: You can use the same results table for multiple data qualityscans.
  6. Optional: Add labels. Labels are key-value pairs that let you grouprelated objects together or with other Google Cloud resources.

  7. Optional: Set up email notification reports to alert people about thestatus and results of a data quality scan job. In theNotification reportsection, clickAdd email ID andenter up to five email addresses. Then, select the scenarios that you wantto send reports for:

  8. ClickCreate.

    After the scan is created, you can run it at any time by clickingRun now.

gcloud

To create a data quality scan, use thegcloud dataplex datascans create data-quality command.

If the source data is organized in a Dataplex Universal Catalog lake, include the--data-source-entity flag:

gclouddataplexdatascanscreatedata-qualityDATASCAN\--location=LOCATION\--data-quality-spec-file=DATA_QUALITY_SPEC_FILE\--data-source-entity=DATA_SOURCE_ENTITY

If the source data isn't organized in a Dataplex Universal Catalog lake, includethe--data-source-resource flag:

gclouddataplexdatascanscreatedata-qualityDATASCAN\--location=LOCATION\--data-quality-spec-file=DATA_QUALITY_SPEC_FILE\--data-source-resource=DATA_SOURCE_RESOURCE

Replace the following variables:

  • DATASCAN: The name of the data quality scan.
  • LOCATION: The Google Cloud region in which tocreate the data quality scan.
  • DATA_QUALITY_SPEC_FILE: The path to the JSON orYAML file containing the specifications for the data quality scan. The filecan be a local file or a Cloud Storage path with the prefixgs://.Use this file to specify the data quality rules for the scan. You can alsospecify additional details in this file, such as filters, sampling percent,and post-scan actions like exporting to BigQuery or sendingemail notification reports. See thedocumentation for JSON representationand theexample YAML representation.
  • DATA_SOURCE_ENTITY: The Dataplex Universal Catalogentity that contains the data for the data quality scan. For example,projects/test-project/locations/test-location/lakes/test-lake/zones/test-zone/entities/test-entity.
  • DATA_SOURCE_RESOURCE: The name of the resourcethat contains the data for the data quality scan. For example,//bigquery.googleapis.com/projects/test-project/datasets/test-dataset/tables/test-table.

C#

C#

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

usingGoogle.Api.Gax.ResourceNames;usingGoogle.Cloud.Dataplex.V1;usingGoogle.LongRunning;publicsealedpartialclassGeneratedDataScanServiceClientSnippets{/// <summary>Snippet for CreateDataScan</summary>/// <remarks>/// This snippet has been automatically generated and should be regarded as a code template only./// It will require modifications to work:/// - It may require correct/in-range values for request initialization./// - It may require specifying regional endpoints when creating the service client as shown in///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint./// </remarks>publicvoidCreateDataScanRequestObject(){// Create clientDataScanServiceClientdataScanServiceClient=DataScanServiceClient.Create();// Initialize request argument(s)CreateDataScanRequestrequest=newCreateDataScanRequest{ParentAsLocationName=LocationName.FromProjectLocation("[PROJECT]","[LOCATION]"),DataScan=newDataScan(),DataScanId="",ValidateOnly=false,};// Make the requestOperation<DataScan,OperationMetadata>response=dataScanServiceClient.CreateDataScan(request);// Poll until the returned long-running operation is completeOperation<DataScan,OperationMetadata>completedResponse=response.PollUntilCompleted();// Retrieve the operation resultDataScanresult=completedResponse.Result;// Or get the name of the operationstringoperationName=response.Name;// This name can be stored, then the long-running operation retrieved later by nameOperation<DataScan,OperationMetadata>retrievedResponse=dataScanServiceClient.PollOnceCreateDataScan(operationName);// Check if the retrieved long-running operation has completedif(retrievedResponse.IsCompleted){// If it has completed, then access the resultDataScanretrievedResult=retrievedResponse.Result;}}}

Go

Go

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

packagemainimport("context"dataplex"cloud.google.com/go/dataplex/apiv1"dataplexpb"cloud.google.com/go/dataplex/apiv1/dataplexpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in://   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=dataplex.NewDataScanClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&dataplexpb.CreateDataScanRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#CreateDataScanRequest.}op,err:=c.CreateDataScan(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}

Java

Java

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

importcom.google.cloud.dataplex.v1.CreateDataScanRequest;importcom.google.cloud.dataplex.v1.DataScan;importcom.google.cloud.dataplex.v1.DataScanServiceClient;importcom.google.cloud.dataplex.v1.LocationName;publicclassSyncCreateDataScan{publicstaticvoidmain(String[]args)throwsException{syncCreateDataScan();}publicstaticvoidsyncCreateDataScan()throwsException{// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_librarytry(DataScanServiceClientdataScanServiceClient=DataScanServiceClient.create()){CreateDataScanRequestrequest=CreateDataScanRequest.newBuilder().setParent(LocationName.of("[PROJECT]","[LOCATION]").toString()).setDataScan(DataScan.newBuilder().build()).setDataScanId("dataScanId1260787906").setValidateOnly(true).build();DataScanresponse=dataScanServiceClient.createDataScanAsync(request).get();}}}

Node.js

Node.js

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

// Copyright 2026 Google LLC//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at////     https://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.//// ** This file is automatically generated by gapic-generator-typescript. **// ** https://github.com/googleapis/gapic-generator-typescript **// ** All changes to this file may be overwritten. **'use strict';functionmain(parent,dataScan,dataScanId){/**   * This snippet has been automatically generated and should be regarded as a code template only.   * It will require modifications to work.   * It may require correct/in-range values for request initialization.   * TODO(developer): Uncomment these variables before running the sample.   *//**   *  Required. The resource name of the parent location:   *  `projects/{project}/locations/{location_id}`   *  where `project` refers to a *project_id* or *project_number* and   *  `location_id` refers to a Google Cloud region.   */// const parent = 'abc123'/**   *  Required. DataScan resource.   */// const dataScan = {}/**   *  Required. DataScan identifier.   *  * Must contain only lowercase letters, numbers and hyphens.   *  * Must start with a letter.   *  * Must end with a number or a letter.   *  * Must be between 1-63 characters.   *  * Must be unique within the customer project / location.   */// const dataScanId = 'abc123'/**   *  Optional. Only validate the request, but do not perform mutations.   *  The default is `false`.   */// const validateOnly = true// Imports the Dataplex libraryconst{DataScanServiceClient}=require('@google-cloud/dataplex').v1;// Instantiates a clientconstdataplexClient=newDataScanServiceClient();asyncfunctioncallCreateDataScan(){// Construct requestconstrequest={parent,dataScan,dataScanId,};// Run requestconst[operation]=awaitdataplexClient.createDataScan(request);const[response]=awaitoperation.promise();console.log(response);}callCreateDataScan();}process.on('unhandledRejection',err=>{console.error(err.message);process.exitCode=1;});main(...process.argv.slice(2));

Python

Python

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

# This snippet has been automatically generated and should be regarded as a# code template only.# It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service#   client as shown in:#   https://googleapis.dev/python/google-api-core/latest/client_options.htmlfromgoogle.cloudimportdataplex_v1defsample_create_data_scan():# Create a clientclient=dataplex_v1.DataScanServiceClient()# Initialize request argument(s)data_scan=dataplex_v1.DataScan()data_scan.data_quality_spec.rules.dimension="dimension_value"data_scan.data.entity="entity_value"request=dataplex_v1.CreateDataScanRequest(parent="parent_value",data_scan=data_scan,data_scan_id="data_scan_id_value",)# Make the requestoperation=client.create_data_scan(request=request)print("Waiting for operation to complete...")response=operation.result()# Handle the responseprint(response)

Ruby

Ruby

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

require"google/cloud/dataplex/v1"### Snippet for the create_data_scan call in the DataScanService service## This snippet has been automatically generated and should be regarded as a code# template only. It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service# client as shown in https://cloud.google.com/ruby/docs/reference.## This is an auto-generated example demonstrating basic usage of# Google::Cloud::Dataplex::V1::DataScanService::Client#create_data_scan.#defcreate_data_scan# Create a client object. The client can be reused for multiple calls.client=Google::Cloud::Dataplex::V1::DataScanService::Client.new# Create a request. To set request fields, pass in keyword arguments.request=Google::Cloud::Dataplex::V1::CreateDataScanRequest.new# Call the create_data_scan method.result=client.create_data_scanrequest# The returned object is of type Gapic::Operation. You can use it to# check the status of an operation, cancel it, or wait for results.# Here is how to wait for a response.result.wait_until_done!timeout:60ifresult.response?presult.responseelseputs"No response received."endend

REST

To create a data quality scan, use thedataScans.create method.

The following request creates a one-time data quality scan:

POSThttps://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataScans?data_scan_id=DATASCAN_ID{"data":{"resource":"//bigquery.googleapis.com/projects/PROJECT_ID/datasets/DATASET_ID/tables/TABLE_ID"},"type":"DATA_QUALITY","executionSpec":{"trigger":{"oneTime":{"ttl_after_scan_completion":"120s"}}},"dataQualitySpec":{"rules":[{"nonNullExpectation":{},"column":"COLUMN_NAME","dimension":"DIMENSION","threshold":1}]}}

Replace the following:

  • PROJECT_ID: Your project ID.
  • LOCATION: The region where to create the data quality scan.
  • DATASCAN_ID: The ID of the data quality scan.
  • DATASET_ID: The ID of BigQuery dataset.
  • TABLE_ID: The ID of BigQuery table.
  • COLUMN_NAME: The column name for the rule.
  • DIMENSION: The dimension for the rule, for exampleVALIDITY.

If you want to build rules for the data quality scan by using rulerecommendations that are based on the results of a data profiling scan, getthe recommendations by calling thedataScans.jobs.generateDataQualityRules methodon the data profiling scan.

Note: If your BigQuerytable is configured with theRequire partition filter set totrue, use theBigQuery partition column as the data quality scan row filter ortimestamp column.

Run a data quality scan

Console

  1. In the Google Cloud console, on the BigQueryMetadata curation page, go to theData profiling & quality tab.

    Go to Data profiling & quality

  2. Click the data quality scan to run.

  3. ClickRun now.

gcloud

To run a data quality scan, use thegcloud dataplex datascans run command:

gcloud dataplex datascans runDATASCAN \--location=LOCATION \

Replace the following variables:

  • LOCATION: The Google Cloud region in which thedata quality scan was created.
  • DATASCAN: The name of the data quality scan.

C#

C#

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

usingGoogle.Cloud.Dataplex.V1;publicsealedpartialclassGeneratedDataScanServiceClientSnippets{/// <summary>Snippet for RunDataScan</summary>/// <remarks>/// This snippet has been automatically generated and should be regarded as a code template only./// It will require modifications to work:/// - It may require correct/in-range values for request initialization./// - It may require specifying regional endpoints when creating the service client as shown in///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint./// </remarks>publicvoidRunDataScanRequestObject(){// Create clientDataScanServiceClientdataScanServiceClient=DataScanServiceClient.Create();// Initialize request argument(s)RunDataScanRequestrequest=newRunDataScanRequest{DataScanName=DataScanName.FromProjectLocationDataScan("[PROJECT]","[LOCATION]","[DATASCAN]"),};// Make the requestRunDataScanResponseresponse=dataScanServiceClient.RunDataScan(request);}}

Go

Go

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

packagemainimport("context"dataplex"cloud.google.com/go/dataplex/apiv1"dataplexpb"cloud.google.com/go/dataplex/apiv1/dataplexpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in://   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=dataplex.NewDataScanClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&dataplexpb.RunDataScanRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#RunDataScanRequest.}resp,err:=c.RunDataScan(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}

Java

Java

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

importcom.google.cloud.dataplex.v1.DataScanName;importcom.google.cloud.dataplex.v1.DataScanServiceClient;importcom.google.cloud.dataplex.v1.RunDataScanRequest;importcom.google.cloud.dataplex.v1.RunDataScanResponse;publicclassSyncRunDataScan{publicstaticvoidmain(String[]args)throwsException{syncRunDataScan();}publicstaticvoidsyncRunDataScan()throwsException{// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_librarytry(DataScanServiceClientdataScanServiceClient=DataScanServiceClient.create()){RunDataScanRequestrequest=RunDataScanRequest.newBuilder().setName(DataScanName.of("[PROJECT]","[LOCATION]","[DATASCAN]").toString()).build();RunDataScanResponseresponse=dataScanServiceClient.runDataScan(request);}}}

Python

Python

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

# This snippet has been automatically generated and should be regarded as a# code template only.# It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service#   client as shown in:#   https://googleapis.dev/python/google-api-core/latest/client_options.htmlfromgoogle.cloudimportdataplex_v1defsample_run_data_scan():# Create a clientclient=dataplex_v1.DataScanServiceClient()# Initialize request argument(s)request=dataplex_v1.RunDataScanRequest(name="name_value",)# Make the requestresponse=client.run_data_scan(request=request)# Handle the responseprint(response)

Ruby

Ruby

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

require"google/cloud/dataplex/v1"### Snippet for the run_data_scan call in the DataScanService service## This snippet has been automatically generated and should be regarded as a code# template only. It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service# client as shown in https://cloud.google.com/ruby/docs/reference.## This is an auto-generated example demonstrating basic usage of# Google::Cloud::Dataplex::V1::DataScanService::Client#run_data_scan.#defrun_data_scan# Create a client object. The client can be reused for multiple calls.client=Google::Cloud::Dataplex::V1::DataScanService::Client.new# Create a request. To set request fields, pass in keyword arguments.request=Google::Cloud::Dataplex::V1::RunDataScanRequest.new# Call the run_data_scan method.result=client.run_data_scanrequest# The returned object is of type Google::Cloud::Dataplex::V1::RunDataScanResponse.presultend

REST

To run a data quality scan, use thedataScans.run method.

Note: Run isn't supported for data quality scans that are on a one-timeschedule.

View data quality scan results

Console

  1. In the Google Cloud console, on the BigQueryMetadata curation page, go to theData profiling & quality tab.

    Go to Data profiling & quality

  2. Click the name of a data quality scan.

    • TheOverview section displays information about the most recentjobs, including when the scan was run, the number of recordsscanned in each job, whether all the data quality checks passed, andif there were failures, the number of data quality checks that failed.

    • TheData quality scan configuration section displays details about thescan.

  3. To see detailed information about a job, such as data quality scores thatindicate the percentage of rules that passed, which rules failed, and thejob logs, click theJobs history tab. Then, click a job ID.

Note: If you exported the scan results to a BigQuery table,then you can also access the scan results from the table. The data qualityscores are available if you published the scan results asDataplex Universal Catalog metadata.

gcloud

To view the results of a data quality scan job, use thegcloud dataplex datascans jobs describe command:

gcloud dataplex datascans jobs describeJOB \--location=LOCATION \--datascan=DATASCAN \--view=FULL

Replace the following variables:

  • JOB: The job ID of the data quality scan job.
  • LOCATION: The Google Cloud region in which the dataquality scan was created.
  • DATASCAN: The name of the data quality scan the jobbelongs to.
  • --view=FULL: To see the scan job result, specifyFULL.

C#

C#

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

usingGoogle.Cloud.Dataplex.V1;publicsealedpartialclassGeneratedDataScanServiceClientSnippets{/// <summary>Snippet for GetDataScan</summary>/// <remarks>/// This snippet has been automatically generated and should be regarded as a code template only./// It will require modifications to work:/// - It may require correct/in-range values for request initialization./// - It may require specifying regional endpoints when creating the service client as shown in///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint./// </remarks>publicvoidGetDataScanRequestObject(){// Create clientDataScanServiceClientdataScanServiceClient=DataScanServiceClient.Create();// Initialize request argument(s)GetDataScanRequestrequest=newGetDataScanRequest{DataScanName=DataScanName.FromProjectLocationDataScan("[PROJECT]","[LOCATION]","[DATASCAN]"),View=GetDataScanRequest.Types.DataScanView.Unspecified,};// Make the requestDataScanresponse=dataScanServiceClient.GetDataScan(request);}}

Go

Go

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

packagemainimport("context"dataplex"cloud.google.com/go/dataplex/apiv1"dataplexpb"cloud.google.com/go/dataplex/apiv1/dataplexpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in://   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=dataplex.NewDataScanClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&dataplexpb.GetDataScanRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#GetDataScanRequest.}resp,err:=c.GetDataScan(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}

Java

Java

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

importcom.google.cloud.dataplex.v1.DataScan;importcom.google.cloud.dataplex.v1.DataScanName;importcom.google.cloud.dataplex.v1.DataScanServiceClient;importcom.google.cloud.dataplex.v1.GetDataScanRequest;publicclassSyncGetDataScan{publicstaticvoidmain(String[]args)throwsException{syncGetDataScan();}publicstaticvoidsyncGetDataScan()throwsException{// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_librarytry(DataScanServiceClientdataScanServiceClient=DataScanServiceClient.create()){GetDataScanRequestrequest=GetDataScanRequest.newBuilder().setName(DataScanName.of("[PROJECT]","[LOCATION]","[DATASCAN]").toString()).build();DataScanresponse=dataScanServiceClient.getDataScan(request);}}}

Python

Python

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

# This snippet has been automatically generated and should be regarded as a# code template only.# It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service#   client as shown in:#   https://googleapis.dev/python/google-api-core/latest/client_options.htmlfromgoogle.cloudimportdataplex_v1defsample_get_data_scan():# Create a clientclient=dataplex_v1.DataScanServiceClient()# Initialize request argument(s)request=dataplex_v1.GetDataScanRequest(name="name_value",)# Make the requestresponse=client.get_data_scan(request=request)# Handle the responseprint(response)

Ruby

Ruby

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

require"google/cloud/dataplex/v1"### Snippet for the get_data_scan call in the DataScanService service## This snippet has been automatically generated and should be regarded as a code# template only. It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service# client as shown in https://cloud.google.com/ruby/docs/reference.## This is an auto-generated example demonstrating basic usage of# Google::Cloud::Dataplex::V1::DataScanService::Client#get_data_scan.#defget_data_scan# Create a client object. The client can be reused for multiple calls.client=Google::Cloud::Dataplex::V1::DataScanService::Client.new# Create a request. To set request fields, pass in keyword arguments.request=Google::Cloud::Dataplex::V1::GetDataScanRequest.new# Call the get_data_scan method.result=client.get_data_scanrequest# The returned object is of type Google::Cloud::Dataplex::V1::DataScan.presultend

REST

To view the results of a data quality scan, use thedataScans.get method.

View published results

If the data quality scan results are published as Dataplex Universal Catalogmetadata, then you can see the latest scan resultson the BigQuery and Dataplex Universal Catalog pages in theGoogle Cloud console, on the source table'sData quality tab.

  1. In the Google Cloud console, go to theBigQuery page.

    Go to BigQuery

  2. In the left pane, clickExplorer:

    Highlighted button for the Explorer pane.

    If you don't see the left pane, clickExpand left pane to open the pane.

  3. In theExplorer pane, clickDatasets, and then click your dataset.

  4. ClickOverview> Tables, and then select the table whose data quality scanresults you want to see.

  5. Click theData quality tab.

    The latest published results are displayed.

    Note: Published results might not be available if a scan is running for the firsttime.

View historical scan results

Dataplex Universal Catalog saves the data quality scan history of the last 300jobs or for the past year, whichever occurs first.

Console

  1. In the Google Cloud console, on the BigQueryMetadata curation page, go to theData profiling & quality tab.

    Go to Data profiling & quality

  2. Click the name of a data quality scan.

  3. Click theJobs history tab.

    TheJobs history tab provides information about past jobs, such asthe number of records scanned in each job, the job status, the timethe job was run, and whether each rule passed or failed.

  4. To view detailed information about a job, click any of the jobs in theJob ID column.

gcloud

To view historical data quality scan jobs, use thegcloud dataplex datascans jobs list command:

gcloud dataplex datascans jobs list \--location=LOCATION \--datascan=DATASCAN \

Replace the following variables:

  • LOCATION: The Google Cloud region in which the dataquality scan was created.
  • DATASCAN: The name of the data quality scan to viewhistorical jobs for.

C#

C#

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

usingGoogle.Api.Gax;usingGoogle.Cloud.Dataplex.V1;usingSystem;publicsealedpartialclassGeneratedDataScanServiceClientSnippets{/// <summary>Snippet for ListDataScanJobs</summary>/// <remarks>/// This snippet has been automatically generated and should be regarded as a code template only./// It will require modifications to work:/// - It may require correct/in-range values for request initialization./// - It may require specifying regional endpoints when creating the service client as shown in///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint./// </remarks>publicvoidListDataScanJobsRequestObject(){// Create clientDataScanServiceClientdataScanServiceClient=DataScanServiceClient.Create();// Initialize request argument(s)ListDataScanJobsRequestrequest=newListDataScanJobsRequest{ParentAsDataScanName=DataScanName.FromProjectLocationDataScan("[PROJECT]","[LOCATION]","[DATASCAN]"),Filter="",};// Make the requestPagedEnumerable<ListDataScanJobsResponse,DataScanJob>response=dataScanServiceClient.ListDataScanJobs(request);// Iterate over all response items, lazily performing RPCs as requiredforeach(DataScanJobiteminresponse){// Do something with each itemConsole.WriteLine(item);}// Or iterate over pages (of server-defined size), performing one RPC per pageforeach(ListDataScanJobsResponsepageinresponse.AsRawResponses()){// Do something with each page of itemsConsole.WriteLine("A page of results:");foreach(DataScanJobiteminpage){// Do something with each itemConsole.WriteLine(item);}}// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as requiredintpageSize=10;Page<DataScanJob>singlePage=response.ReadPage(pageSize);// Do something with the page of itemsConsole.WriteLine($"A page of {pageSize} results (unless it's the final page):");foreach(DataScanJobiteminsinglePage){// Do something with each itemConsole.WriteLine(item);}// Store the pageToken, for when the next page is required.stringnextPageToken=singlePage.NextPageToken;}}

Go

Go

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

packagemainimport("context"dataplex"cloud.google.com/go/dataplex/apiv1"dataplexpb"cloud.google.com/go/dataplex/apiv1/dataplexpb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in://   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=dataplex.NewDataScanClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&dataplexpb.ListDataScanJobsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#ListDataScanJobsRequest.}it:=c.ListDataScanJobs(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*dataplexpb.ListDataScanJobsResponse)}}

Java

Java

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

importcom.google.cloud.dataplex.v1.DataScanJob;importcom.google.cloud.dataplex.v1.DataScanName;importcom.google.cloud.dataplex.v1.DataScanServiceClient;importcom.google.cloud.dataplex.v1.ListDataScanJobsRequest;publicclassSyncListDataScanJobs{publicstaticvoidmain(String[]args)throwsException{syncListDataScanJobs();}publicstaticvoidsyncListDataScanJobs()throwsException{// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_librarytry(DataScanServiceClientdataScanServiceClient=DataScanServiceClient.create()){ListDataScanJobsRequestrequest=ListDataScanJobsRequest.newBuilder().setParent(DataScanName.of("[PROJECT]","[LOCATION]","[DATASCAN]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").setFilter("filter-1274492040").build();for(DataScanJobelement:dataScanServiceClient.listDataScanJobs(request).iterateAll()){// doThingsWith(element);}}}}

Python

Python

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

# This snippet has been automatically generated and should be regarded as a# code template only.# It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service#   client as shown in:#   https://googleapis.dev/python/google-api-core/latest/client_options.htmlfromgoogle.cloudimportdataplex_v1defsample_list_data_scan_jobs():# Create a clientclient=dataplex_v1.DataScanServiceClient()# Initialize request argument(s)request=dataplex_v1.ListDataScanJobsRequest(parent="parent_value",)# Make the requestpage_result=client.list_data_scan_jobs(request=request)# Handle the responseforresponseinpage_result:print(response)

Ruby

Ruby

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

require"google/cloud/dataplex/v1"### Snippet for the list_data_scan_jobs call in the DataScanService service## This snippet has been automatically generated and should be regarded as a code# template only. It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service# client as shown in https://cloud.google.com/ruby/docs/reference.## This is an auto-generated example demonstrating basic usage of# Google::Cloud::Dataplex::V1::DataScanService::Client#list_data_scan_jobs.#deflist_data_scan_jobs# Create a client object. The client can be reused for multiple calls.client=Google::Cloud::Dataplex::V1::DataScanService::Client.new# Create a request. To set request fields, pass in keyword arguments.request=Google::Cloud::Dataplex::V1::ListDataScanJobsRequest.new# Call the list_data_scan_jobs method.result=client.list_data_scan_jobsrequest# The returned object is of type Gapic::PagedEnumerable. You can iterate# over elements, and API calls will be issued to fetch pages as needed.result.eachdo|item|# Each element is of type ::Google::Cloud::Dataplex::V1::DataScanJob.pitemendend

REST

To view historical data quality scan jobs, use thedataScans.jobs.list method.

Grant access to data quality scan results

To enable the users in your organization to view the scan results, do the following:

  1. In the Google Cloud console, on the BigQueryMetadata curation page, go to theData profiling & quality tab.

    Go to Data profiling & quality

  2. Click the data quality scan you want to share the results of.

  3. Click thePermissions tab.

  4. Do the following:

    • To grant access to a principal, clickGrant access. Grant theDataplex DataScan DataViewer role to theassociated principal.
    • To remove access from a principal, select the principal that youwant to remove theDataplex DataScan DataViewer role from. ClickRemove access, and then confirm when prompted.

Troubleshoot a data quality failure

You can set alerts for data quality failures using the logs in Cloud Logging.For more information, including sample queries, seeSet alerts in Cloud Logging.

For each job with row-level rules that fail, Dataplex Universal Catalog providesa query to get the failed records. Run this query to see the records that didnot match your rule.

Note: The query returns all of the columns of the table, not just the failedcolumn.

Console

  1. In the Google Cloud console, on the BigQueryMetadata curation page, go to theData profiling & quality tab.

    Go to Data profiling & quality

  2. Click the name of the data quality scan whose records you want to troubleshoot.

  3. Click theJobs history tab.

  4. Click the job ID of the job that identified data quality failures.

  5. In the job results window that opens, in theRules section, find the columnQuery to get failed records. ClickCopy query to clipboard for thefailed rule.

  6. Run the query in BigQueryto see the records that caused the job to fail.

gcloud

Not supported.

REST

  1. To get the job that identified the data quality failures, use thedataScans.get method.

    In the response object, thefailingRowsQuery field shows the query.

  2. Run the query in BigQueryto see the records that caused the job to fail.

Dataplex Universal Catalog also runs the debug query, provided it was includedduring the rule creation. The debug query results are included in each rule'soutput. This feature is inPreview.

Console

Not supported.

gcloud

Not supported.

REST

To get the job that identified the data quality failures, use thedataScans.get method.In the response object, thedebugQueriesResultSets field shows theresults of the debug queries.

Manage data quality scans for a specific table

The steps in this document show how to manage data quality scans across yourproject by using the BigQueryMetadata curation> Data profiling & quality page in theGoogle Cloud console.

You can also create and manage data quality scans when working with aspecific table. In the Google Cloud console, on the BigQuerypage for the table, use theData quality tab. Do the following:

  1. In the Google Cloud console, go to theBigQuery page.

    Go to BigQuery

    In theExplorer pane (in the left pane), clickDatasets, and then click your dataset. ClickOverview> Tables, and then select the table whose data quality scan results you want to see.

  2. Click theData quality tab.

  3. Depending on whether the table has a data quality scan whose results arepublished as Dataplex Universal Catalog metadata, you can work with the table'sdata quality scans in the following ways:

    • Data quality scan results are published: the latest scan results aredisplayed on the page.

      To manage the data quality scans for this table, clickData qualityscan, and then select from the following options:

      • Create new scan: create a new data quality scan. For moreinformation, see theCreate a data quality scan sectionof this document. When you create a scan from a table's details page, thetable is preselected.

      • Run now: run the scan.

      • Edit scan configuration: edit settings including the display name,filters, and schedule.

        To edit the data quality rules, on theData quality tab, click theRules tab. ClickModify rules. Update the rules and then clickSave.

      • Manage scan permissions: control who can access the scan results.For more information, see theGrant access to data quality scan resultssection of this document.

      • View historical results: view detailed information about previousdata quality scan jobs. For more information, see theView data quality scan results andView historical scan results sections ofthis document.

      • View all scans: view a list of data quality scans that apply to thistable.

    • Data quality scan results aren't published: select from thefollowing options:

      • Create data quality scan: create a new data quality scan. For moreinformation, see theCreate a data quality scan sectionof this document. When you create a scan from a table's details page, thetable is preselected.

      • View existing scans: view a list of data quality scans that apply tothis table.

View the data quality scans for a table

To view the data quality scans that apply to a specific table, do the following:

  1. In the Google Cloud console, on the BigQueryMetadata curation page, go to theData profiling & quality tab.

    Go to Data profiling & quality

  2. Filter the list by table name and scan type.

Update a data quality scan

You can edit various settings for an existing data quality scan, such as thedisplay name, filters, schedule, and data quality rules.

Note: If an existing data quality scan publishes the results to theBigQuery and Dataplex Universal Catalog pages in theGoogle Cloud console, and you instead want to publish future scan results asDataplex Universal Catalog metadata, you must edit the scan and re-enable publishing.You might need additional permissions to enable catalog publishing.

Console

  1. In the Google Cloud console, on the BigQueryMetadata curation page, go to theData profiling & quality tab.

    Go to Data profiling & quality

  2. Click the name of a data quality scan.

  3. To edit settings including the display name, filters, and schedule, clickEdit. Edit the values and then clickSave.

  4. To edit the data quality rules, on the scan details page, click theCurrent rules tab. ClickModify rules. Update the rules andthen clickSave.

gcloud

To update the description of a data quality scan, use thegcloud dataplex datascans update data-quality command:

gcloud dataplex datascans update data-qualityDATASCAN \--location=LOCATION \--description=DESCRIPTION

Replace the following:

  • DATASCAN: The name of the data quality scan toupdate.
  • LOCATION: The Google Cloud region in which the dataquality scan was created.
  • DESCRIPTION: The new description for the dataquality scan.
Note: You can update specification fields, such asrules,rowFilter, orsamplingPercent, in the data quality specification file. Refer toJSON andYAML representations.

C#

C#

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

usingGoogle.Cloud.Dataplex.V1;usingGoogle.LongRunning;usingGoogle.Protobuf.WellKnownTypes;publicsealedpartialclassGeneratedDataScanServiceClientSnippets{/// <summary>Snippet for UpdateDataScan</summary>/// <remarks>/// This snippet has been automatically generated and should be regarded as a code template only./// It will require modifications to work:/// - It may require correct/in-range values for request initialization./// - It may require specifying regional endpoints when creating the service client as shown in///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint./// </remarks>publicvoidUpdateDataScanRequestObject(){// Create clientDataScanServiceClientdataScanServiceClient=DataScanServiceClient.Create();// Initialize request argument(s)UpdateDataScanRequestrequest=newUpdateDataScanRequest{DataScan=newDataScan(),UpdateMask=newFieldMask(),ValidateOnly=false,};// Make the requestOperation<DataScan,OperationMetadata>response=dataScanServiceClient.UpdateDataScan(request);// Poll until the returned long-running operation is completeOperation<DataScan,OperationMetadata>completedResponse=response.PollUntilCompleted();// Retrieve the operation resultDataScanresult=completedResponse.Result;// Or get the name of the operationstringoperationName=response.Name;// This name can be stored, then the long-running operation retrieved later by nameOperation<DataScan,OperationMetadata>retrievedResponse=dataScanServiceClient.PollOnceUpdateDataScan(operationName);// Check if the retrieved long-running operation has completedif(retrievedResponse.IsCompleted){// If it has completed, then access the resultDataScanretrievedResult=retrievedResponse.Result;}}}

Go

Go

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

packagemainimport("context"dataplex"cloud.google.com/go/dataplex/apiv1"dataplexpb"cloud.google.com/go/dataplex/apiv1/dataplexpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in://   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=dataplex.NewDataScanClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&dataplexpb.UpdateDataScanRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateDataScanRequest.}op,err:=c.UpdateDataScan(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}

Java

Java

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

importcom.google.cloud.dataplex.v1.DataScan;importcom.google.cloud.dataplex.v1.DataScanServiceClient;importcom.google.cloud.dataplex.v1.UpdateDataScanRequest;importcom.google.protobuf.FieldMask;publicclassSyncUpdateDataScan{publicstaticvoidmain(String[]args)throwsException{syncUpdateDataScan();}publicstaticvoidsyncUpdateDataScan()throwsException{// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_librarytry(DataScanServiceClientdataScanServiceClient=DataScanServiceClient.create()){UpdateDataScanRequestrequest=UpdateDataScanRequest.newBuilder().setDataScan(DataScan.newBuilder().build()).setUpdateMask(FieldMask.newBuilder().build()).setValidateOnly(true).build();DataScanresponse=dataScanServiceClient.updateDataScanAsync(request).get();}}}

Python

Python

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

# This snippet has been automatically generated and should be regarded as a# code template only.# It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service#   client as shown in:#   https://googleapis.dev/python/google-api-core/latest/client_options.htmlfromgoogle.cloudimportdataplex_v1defsample_update_data_scan():# Create a clientclient=dataplex_v1.DataScanServiceClient()# Initialize request argument(s)data_scan=dataplex_v1.DataScan()data_scan.data_quality_spec.rules.dimension="dimension_value"data_scan.data.entity="entity_value"request=dataplex_v1.UpdateDataScanRequest(data_scan=data_scan,)# Make the requestoperation=client.update_data_scan(request=request)print("Waiting for operation to complete...")response=operation.result()# Handle the responseprint(response)

Ruby

Ruby

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

require"google/cloud/dataplex/v1"### Snippet for the update_data_scan call in the DataScanService service## This snippet has been automatically generated and should be regarded as a code# template only. It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service# client as shown in https://cloud.google.com/ruby/docs/reference.## This is an auto-generated example demonstrating basic usage of# Google::Cloud::Dataplex::V1::DataScanService::Client#update_data_scan.#defupdate_data_scan# Create a client object. The client can be reused for multiple calls.client=Google::Cloud::Dataplex::V1::DataScanService::Client.new# Create a request. To set request fields, pass in keyword arguments.request=Google::Cloud::Dataplex::V1::UpdateDataScanRequest.new# Call the update_data_scan method.result=client.update_data_scanrequest# The returned object is of type Gapic::Operation. You can use it to# check the status of an operation, cancel it, or wait for results.# Here is how to wait for a response.result.wait_until_done!timeout:60ifresult.response?presult.responseelseputs"No response received."endend

REST

To edit a data quality scan, use thedataScans.patch method.

Note: Update isn't supported for data quality scans that are on a one-timeschedule.

Delete a data quality scan

Console

Console

  1. In the Google Cloud console, on the BigQueryMetadata curation page, go to theData profiling & quality tab.

    Go to Data profiling & quality

  2. Click the scan you want to delete.

  3. ClickDelete, and then confirm when prompted.

gcloud

gcloud

To delete a data quality scan, use thegcloud dataplex datascans delete command:

gcloud dataplex datascans deleteDATASCAN \--location=LOCATION \--async

Replace the following variables:

  • DATASCAN: The name of the data quality scan todelete.
  • LOCATION: The Google Cloud region in which the dataquality scan was created.

C#

C#

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

usingGoogle.Cloud.Dataplex.V1;usingGoogle.LongRunning;usingGoogle.Protobuf.WellKnownTypes;publicsealedpartialclassGeneratedDataScanServiceClientSnippets{/// <summary>Snippet for DeleteDataScan</summary>/// <remarks>/// This snippet has been automatically generated and should be regarded as a code template only./// It will require modifications to work:/// - It may require correct/in-range values for request initialization./// - It may require specifying regional endpoints when creating the service client as shown in///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint./// </remarks>publicvoidDeleteDataScanRequestObject(){// Create clientDataScanServiceClientdataScanServiceClient=DataScanServiceClient.Create();// Initialize request argument(s)DeleteDataScanRequestrequest=newDeleteDataScanRequest{DataScanName=DataScanName.FromProjectLocationDataScan("[PROJECT]","[LOCATION]","[DATASCAN]"),Force=false,};// Make the requestOperation<Empty,OperationMetadata>response=dataScanServiceClient.DeleteDataScan(request);// Poll until the returned long-running operation is completeOperation<Empty,OperationMetadata>completedResponse=response.PollUntilCompleted();// Retrieve the operation resultEmptyresult=completedResponse.Result;// Or get the name of the operationstringoperationName=response.Name;// This name can be stored, then the long-running operation retrieved later by nameOperation<Empty,OperationMetadata>retrievedResponse=dataScanServiceClient.PollOnceDeleteDataScan(operationName);// Check if the retrieved long-running operation has completedif(retrievedResponse.IsCompleted){// If it has completed, then access the resultEmptyretrievedResult=retrievedResponse.Result;}}}

Go

Go

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

packagemainimport("context"dataplex"cloud.google.com/go/dataplex/apiv1"dataplexpb"cloud.google.com/go/dataplex/apiv1/dataplexpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in://   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=dataplex.NewDataScanClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&dataplexpb.DeleteDataScanRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#DeleteDataScanRequest.}op,err:=c.DeleteDataScan(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}

Java

Java

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

importcom.google.cloud.dataplex.v1.DataScanName;importcom.google.cloud.dataplex.v1.DataScanServiceClient;importcom.google.cloud.dataplex.v1.DeleteDataScanRequest;importcom.google.protobuf.Empty;publicclassSyncDeleteDataScan{publicstaticvoidmain(String[]args)throwsException{syncDeleteDataScan();}publicstaticvoidsyncDeleteDataScan()throwsException{// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_librarytry(DataScanServiceClientdataScanServiceClient=DataScanServiceClient.create()){DeleteDataScanRequestrequest=DeleteDataScanRequest.newBuilder().setName(DataScanName.of("[PROJECT]","[LOCATION]","[DATASCAN]").toString()).setForce(true).build();dataScanServiceClient.deleteDataScanAsync(request).get();}}}

Python

Python

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

# This snippet has been automatically generated and should be regarded as a# code template only.# It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service#   client as shown in:#   https://googleapis.dev/python/google-api-core/latest/client_options.htmlfromgoogle.cloudimportdataplex_v1defsample_delete_data_scan():# Create a clientclient=dataplex_v1.DataScanServiceClient()# Initialize request argument(s)request=dataplex_v1.DeleteDataScanRequest(name="name_value",)# Make the requestoperation=client.delete_data_scan(request=request)print("Waiting for operation to complete...")response=operation.result()# Handle the responseprint(response)

Ruby

Ruby

To authenticate to BigQuery, set up Application Default Credentials. For more information, seeSet up authentication for a local development environment.

require"google/cloud/dataplex/v1"### Snippet for the delete_data_scan call in the DataScanService service## This snippet has been automatically generated and should be regarded as a code# template only. It will require modifications to work:# - It may require correct/in-range values for request initialization.# - It may require specifying regional endpoints when creating the service# client as shown in https://cloud.google.com/ruby/docs/reference.## This is an auto-generated example demonstrating basic usage of# Google::Cloud::Dataplex::V1::DataScanService::Client#delete_data_scan.#defdelete_data_scan# Create a client object. The client can be reused for multiple calls.client=Google::Cloud::Dataplex::V1::DataScanService::Client.new# Create a request. To set request fields, pass in keyword arguments.request=Google::Cloud::Dataplex::V1::DeleteDataScanRequest.new# Call the delete_data_scan method.result=client.delete_data_scanrequest# The returned object is of type Gapic::Operation. You can use it to# check the status of an operation, cancel it, or wait for results.# Here is how to wait for a response.result.wait_until_done!timeout:60ifresult.response?presult.responseelseputs"No response received."endend

REST

REST

To delete a data quality scan, use thedataScans.delete method.

Note: Delete isn't supported for data quality scans that are on a one-timeschedule.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.