Skip to content

Instantly share code, notes, and snippets.

@nov05
Last active May 12, 2026 05:06
Show Gist options
  • Select an option

  • Save nov05/aeeec3fa4c5d7d8e26e65609bce0f16b to your computer and use it in GitHub Desktop.

Select an option

Save nov05/aeeec3fa4c5d7d8e26e65609bce0f16b to your computer and use it in GitHub Desktop.

🟒 Assessing Data Quality with Knowledge Catalog (GSP1158)

https://www.skills.google/games/7172/labs/44415

βœ… Test result for nov05_gsp1158.sh:
it passed all the lab checks.

Welcome to Cloud Shell! Type "help" to get started, or type "gemini" to try prompting with Gemini CLI.
Your Cloud Platform project in this session is set to qwiklabs-gcp-00-e7f0a808026e.
Use `gcloud config set project [PROJECT_ID]` to change to a different project.
student_00_efb3c5f88f66@cloudshell:~ (qwiklabs-gcp-00-e7f0a808026e)$ rm -f nov05_gsp1158.sh
curl -LO https://raw.githubusercontent.com/nov05/gcp-skills-boost/refs/heads/dev/GSP1158%20Assessing%20Data%20Quality%20with%20Knowledge%20Catalog/nov05_gsp1158.sh
chmod +x nov05_gsp1158.sh
./nov05_gsp1158.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
student_00_efb3c5f88f66@cloudshell:~ (qwiklabs-gcp-00-e7f0a808026e)$ ./nov05_gsp1158.sh.sh
Your active configuration is: [cloudshell-20629]
Your active configuration is: [cloudshell-20629]
Updated property [compute/region].

πŸ”Ή  Project ID: qwiklabs-gcp-00-e7f0a808026e
πŸ”Ή  Project number: 559412330307
πŸ”Ή  Region: europe-west4
πŸ”Ή  Zone: europe-west4-a
πŸ”Ή  User: student_00_efb3c5f88f66
πŸ”Ή  Bukect: qwiklabs-gcp-00-e7f0a808026e-bucket

========================================================
Task 1. Create a lake, zone, and asset in Knowledge Catalog
========================================================

ERROR: (gcloud.dataplex.lakes.create) Status code: 409. Resource 'projects/qwiklabs-gcp-00-e7f0a808026e/locations/europe-west4/lakes/ecommerce-lake' already exists.
ERROR: (gcloud.dataplex.zones.create) Status code: 400. Zone ID 'customer-contact-raw-zone' is already in use in this project..
ERROR: (gcloud.dataplex.assets.create) Status code: 400. Provided resource 'projects/qwiklabs-gcp-00-e7f0a808026e/datasets/customers' is already attached.

========================================================
Task 2. Query a BigQuery table to review data quality
========================================================

    tableId      Type    Labels   Time Partitioning   Clustered Fields  
 -------------- ------- -------- ------------------- ------------------ 
  contact_info   TABLE                                                  
+---------------------+-------+------------+-----------+-----+-------------------------------+----------------------+---------------------------+-----+---------+-------------+-----------------+
|     created_at      |  id   | first_name | last_name | age |             email             |         city         |           state           | zip | country |  latitude   |    longitude    |
+---------------------+-------+------------+-----------+-----+-------------------------------+----------------------+---------------------------+-----+---------+-------------+-----------------+
| 2020-03-26 06:54:33 |  NULL | Chris      | Smith     |  37 | chris.smith@example.com       | Halliwell            | Bolton                    | BL1 | UK      | 53.59695347 |    -2.448041178 |
| 2021-10-26 10:23:59 |  NULL | William    | Long      |  29 | william.long@example.com      | Chippenham           | Ely                       | CB7 | UK      | 52.36557078 |    0.3091317822 |
| 2022-02-11 16:48:25 |  NULL | David      | Williams  |  47 | david.williams@example.com    | Felsted              | Uttlesford                | CM6 | UK      |  51.8746987 |    0.3805200191 |
| 2020-08-05 08:29:54 |  NULL | Daniel     | Carroll   |  33 | daniel.carroll@example.com    | Belmont              | Bolton                    | BL7 | UK      | 53.63144467 |    -2.427345706 |
| 2022-08-06 11:58:25 |  NULL | Adrian     | Tolbert   |  33 | NULL                          | Aspatria             | Allerdale                 | CA7 | UK      | 54.81554267 |    -3.232825304 |
| 2020-11-12 16:26:57 |  NULL | Anthony    | Walker    |  70 | anthony.walker@example.com    | Albourne             | Lewes                     | BN6 | UK      | 50.92353109 |   -0.1611342291 |
| 2022-11-25 19:13:05 |  NULL | Robert     | Todd      |  52 | robert.todd@example.com       | Charlestown          | Salford                   | M6  | UK      | 53.49719989 |    -2.303323438 |
| 2022-07-05 09:50:01 |  NULL | James      | Peden     |  69 | james.peden@example.com       | Little Lever         | Bolton                    | BL3 | UK      | 53.56346384 |    -2.431024592 |
| 2022-11-21 19:36:13 |  NULL | Max        | Leffler   |  47 | max.leffler@example.com       | Lemsford             | Welwyn Hatfield           | AL8 | UK      | 51.79967448 |     -0.20798429 |
| 2020-08-30 20:11:12 |  NULL | Ricardo    | Jordan    |  14 | ricardo.jordan@example.com    | Lower Edmonton       | Enfield                   | N9  | UK      |  51.6320383 |   -0.0631434156 |
| 2020-01-01 19:24:12 |   137 | Joe        | Jones     |  48 | joe.jones@example.com         | Blackrod             | Bolton                    | BL6 | UK      | 53.59192782 |    -2.537388616 |
| 2020-01-27 10:18:16 |  1333 | Lee        | Hodson    |  18 | lee.hodson@example.com        | Witcham              | Ely                       | CB6 | UK      | 52.39865382 |    0.2170883111 |
| 2020-02-09 03:53:14 |  2031 | Johnnie    | Rosado    |  48 | johnnie.rosado@example.com    | Bolton               | Bolton                    | BL7 | UK      | 53.62161728 |     -2.41449554 |
| 2020-02-13 11:47:24 |  2242 | Steven     | White     |  39 | steven.white@example.com      | Witcham              | Ely                       | CB6 | UK      | 52.40051395 |    0.2328296654 |
| 2020-04-09 14:44:31 |  5006 | Emil       | Flemings  |  59 | emil.flemings@example.com     | Bobbingworth         | Epping Forest             | CM5 | UK      | 51.71086354 |    0.2475378727 |
| 2020-04-29 22:35:27 |  6043 | Norman     | Hurley    |  93 | norman.hurley@example.com     | Water Orton          | North Warwickshire        | B46 | UK      | 52.50481641 |    -1.700915573 |
| 2020-06-11 01:48:59 |  7967 | Glen       | Schneider |  63 | glen.schneider@example.com    | Apes Hall            | Ely                       | CB6 | UK      | 52.40013549 |    0.2185730875 |
| 2020-06-14 19:32:53 |  8081 | Joseph     | Chavez    |  63 | example.com                   | Water Orton          | North Warwickshire        | B46 | UK      | 52.50129443 |    -1.705245292 |
| 2020-06-19 11:07:42 |  8333 | Neil       | Fizer     |  14 | neil.fizer@example.com        | Apes Hall            | Ely                       | CB6 | UK      | 52.39752926 |    0.2246657403 |
| 2020-07-02 12:36:40 |  9008 | Alvin      | Wood      |  62 | alvin.wood@example.com        | Southease            | Lewes                     | BN7 | UK      | 50.87656696 |  0.009430346077 |
| 2020-07-06 07:51:17 |  9165 | Donald     | Kleiber   |  39 | donald.kleiber@example.com    | Southease            | Lewes                     | BN7 | UK      | 50.87905336 | -0.005031699935 |
| 2020-07-29 16:07:30 | 10311 | Charles    | Weeks     |  46 | charles.weeks@example.com     | Over Hulton          | Bolton                    | BL5 | UK      | 53.55680362 |    -2.517049437 |
| 2020-07-31 10:25:20 | 10434 | Gary       | Hicks     |  56 | hicks                         | Aldreth              | Ely                       | CB6 | UK      | 52.39756236 |    0.2260116699 |
| 2020-08-31 05:52:27 | 11961 | Bobby      | Morales   |  47 | bobby.morales@example.com     | Kensington           | Kensington and Chelsea    | W8  | UK      | 51.50500464 |   -0.1911266634 |
| 2020-09-14 11:03:47 | 12929 | Steve      | Wells     |  57 | steve.wells@example.com       | Prickwillow          | Ely                       | CB7 | UK      | 52.37884057 |    0.3151057067 |
| 2020-09-28 10:13:22 | 13808 | Larry      | Forman    |  64 | NULL                          | Hamsey               | Lewes                     | BN8 | UK      | 50.91048224 |   0.05599379129 |
| 2020-10-26 09:05:38 | 15573 | John       | Burrell   |  51 | john.burrell@example.com      | Ainsworth            | Bolton                    | BL2 | UK      |  53.5807953 |     -2.40409684 |
| 2020-11-02 10:57:19 | 16062 | Patrick    | Johnson   |  14 | patrick.johnson@example.com   | Ainsworth            | Bolton                    | BL2 | UK      | 53.58209434 |    -2.394574529 |
| 2020-11-17 01:40:12 | 17278 | Robert     | Jefferson |  36 | robert.jefferson@example.com  | Walmersley           | Bury                      | BL9 | UK      | 53.58399333 |    -2.287276006 |
| 2020-11-18 09:55:16 | 17346 | Lowell     | Bowles    |  14 | lowell.bowles@example.com     | Shortgate            | Lewes                     | BN8 | UK      | 50.91534517 |   0.04879781645 |
| 2020-12-06 17:53:27 | 18713 | Roger      | Wise      |  63 | roger.wise@example.com        | Ringmer              | Lewes                     | BN8 | UK      | 50.92052823 |   0.04291676898 |
| 2020-12-17 06:56:08 | 19650 | Armand     | Isler     |  16 | armand.isler@example.com      | Finchley             | Barnet                    | N3  | UK      | 51.60484201 |   -0.1913474957 |
| 2020-12-25 10:55:30 | 20358 | Edward     | Moon      |  16 | edward.moon@example.com       | Farnworth            | Bolton                    | BL4 | UK      | 53.55474704 |    -2.408628836 |
| 2021-01-14 12:17:11 | 21849 | Adam       | Neuman    |  36 | adam.neuman                   | Weaste               | Salford                   | M5  | UK      | 53.48168705 |    -2.281726773 |
| 2021-01-19 09:24:17 | 22106 | James      | Douglas   |  64 | james.douglas@example.com     | Ayot St Lawrence     | Welwyn Hatfield           | AL6 | UK      | 51.82602597 |   -0.1933141612 |
| 2021-01-21 19:26:11 | 22256 | John       | Schroeder |  20 | john.schroeder@example.com    | Wythall              | Bromsgrove Worcestershire | B47 | UK      | 52.38996797 |     -1.88828336 |
| 2021-02-01 13:28:36 | 22963 | Stephen    | Canales   |  27 | stephen.canales@example.com   | Coleshill            | North Warwickshire        | B46 | UK      | 52.51198339 |    -1.706349183 |
| 2021-03-08 08:44:26 | 25447 | Marco      | Scherer   |  49 | marco.scherer@example.com     | Tonge Moor           | Bolton                    | BL2 | UK      | 53.59297417 |    -2.402616782 |
| 2021-03-16 15:09:55 | 25941 | Richard    | Gillespie |  64 | richard.gillespie@example.com | Harwood              | Bolton                    | BL2 | UK      | 53.58588443 |    -2.404352749 |
| 2021-03-23 13:22:25 | 26490 | Richard    | Coley     |  41 | richard.coley@example.com     | Kensington           | Kensington and Chelsea    | W8  | UK      | 51.49340882 |   -0.1969796509 |
| 2021-04-02 13:25:28 | 27174 | Brenton    | Kinney    |  14 | brenton.kinney@example.com    | Felsted              | Uttlesford                | CM6 | UK      | 51.88649843 |    0.3648757113 |
| 2021-04-07 09:40:14 | 27589 | Joseph     | Garcia    |  16 | joseph.garcia@example.com     | Tarring Neville      | Lewes                     | BN9 | UK      | 50.79456703 |   0.02986518987 |
| 2021-05-02 21:36:36 | 29276 | Jeffrey    | Clanton   |  14 | jeffrey.clanton@example.com   | Smithills            | Bolton                    | BL1 | UK      | 53.58982423 |    -2.440229553 |
| 2021-05-06 14:09:04 | 29580 | George     | Campos    |  63 | george.campos@example.com     | Heaton               | Bolton                    | BL1 | UK      |  53.5887095 |    -2.443805181 |
| 2021-06-01 12:48:43 | 31338 | Timothy    | White     |  59 | example.com                   | Lostock              | Bolton                    | BL6 | UK      | 53.59720726 |    -2.540022221 |
| 2021-06-18 15:08:48 | 32540 | Michael    | Saldivar  |  12 | michael.saldivar@example.com  | Greenmount           | Bury                      | BL8 | UK      |  53.5994336 |    -2.325158349 |
| 2021-07-16 11:18:39 | 34621 | Joseph     | Upton     |  12 | joseph.upton@example.com      | Bury                 | Bury                      | BL9 | UK      | 53.58596458 |     -2.28244567 |
| 2021-08-19 10:48:47 | 37177 | Dale       | Love      |  39 | dale.love@example.com         | Witcham              | Ely                       | CB6 | UK      | 52.39926944 |    0.2293514311 |
| 2021-09-27 20:01:45 | 40732 | Donald     | Howard    |  63 | donald.howard@example.com     | Irlams O' Th' Height | Salford                   | M6  | UK      | 53.49833659 |    -2.299832866 |
| 2021-10-06 10:12:20 | 41676 | Brandon    | Anderson  |  44 | brandon.anderson@example.com  | Moreton              | Epping Forest             | CM5 | UK      | 51.72305467 |    0.2455255725 |
+---------------------+-------+------------+-----------+-----+-------------------------------+----------------------+---------------------------+-----+---------+-------------+-----------------+
+-------------+
| missing_ids |
+-------------+
|          10 |
+-------------+

πŸ‘‰  Click the link to run the query in BigQuery:
https://console.cloud.google.com/bigquery?project=qwiklabs-gcp-00-e7f0a808026e

  SELECT * FROM `qwiklabs-gcp-00-e7f0a808026e.customers.contact_info`
  ORDER BY id
  LIMIT 50

Ready to proceed?
 (y/n): y

========================================================
Task 3. Create and upload a data quality specification file
========================================================

Google recommends using Gcloud storage CLI (https://docs.cloud.google.com/storage/docs/discover-object-storage-gcloud) instead of gsutil. Please refer to migration guide (https://docs.cloud.google.com/storage/docs/gsutil-transition-to-gcloud) for assistance.
Copying file://dq-customer-raw-data.yaml [Content-Type=application/yaml]...
- [1 files][  354.0 B/  354.0 B]                                                
Operation completed over 1 objects/354.0 B.                                      

========================================================
Task 4. Define and run an auto data quality job in Knowledge Catalog
========================================================

Waiting for [projects/qwiklabs-gcp-00-e7f0a808026e/locations/europe-west4/opera
tions/operation-1778561249985-651978f8444b7-7426780b-6487ef8f] to finish...work
ing.                                                                           
Waiting for [projects/qwiklabs-gcp-00-e7f0a808026e/locations/europe-west4/opera
tions/operation-1778561249985-651978f8444b7-7426780b-6487ef8f] to finish...done
.
Created [projects/qwiklabs-gcp-00-e7f0a808026e/locations/europe-west4/dataScans/customer-orders-data-quality-job] Data quality scan created in project [qwiklabs-gcp-00-e7f0a808026e] with location [europe-west4].
createTime: '2026-05-12T04:47:30.413603309Z'
data:
  resource: //bigquery.googleapis.com/projects/qwiklabs-gcp-00-e7f0a808026e/datasets/customers/tables/contact_info
executionSpec:
  trigger:
    onDemand: {}
executionStatus: {}
name: projects/qwiklabs-gcp-00-e7f0a808026e/locations/europe-west4/dataScans/customer-orders-data-quality-job
state: ACTIVE
type: DATA_QUALITY
uid: 2c44d5e2-1193-4691-bee6-9e1b40bf196d
updateTime: '2026-05-12T04:48:48.209176575Z'
job:
  createTime: '1970-01-01T00:00:00Z'
  dataQualitySpec:
    postScanActions:
      bigqueryExport:
        resultsTable: projects/qwiklabs-gcp-00-e7f0a808026e/datasets/customers_dq_dataset/tables/dq_results
    rules:
    - column: id
      dimension: COMPLETENESS
      nonNullExpectation: {}
      threshold: 1.0
    - column: email
      dimension: CONFORMANCE
      ignoreNull: true
      regexExpectation:
        regex: ^[^@]+[@]{1}[^@]+$
      threshold: 0.85
  name: projects/559412330307/locations/europe-west4/dataScans/customer-orders-data-quality-job/jobs/d0c1e246-3f04-4a32-bcac-7bbeeb46c071
  state: PENDING
  type: DATA_QUALITY
  uid: d0c1e246-3f04-4a32-bcac-7bbeeb46c071

πŸ‘‰  Running customer-orders-data-quality-job...
Job status: PENDING
Job status: PENDING
Job status: RUNNING
Job status: RUNNING
Job status: RUNNING
Job status: RUNNING
Job status: RUNNING
Job status: RUNNING
Job status: SUCCEEDED
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+------------+---------------------+---------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+------------------+-----------+------------------+-------------+----------------------+-------------+----------------+------------------------+--------------------------------+-------------+---------------------+------------------+--------------------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+--------------------------+---------------+-----------------+-------------+----------------+
|                                                                                                                                 data_quality_scan                                                                                                                                 |                                                                                                                                                                                                                          data_source                                                                                                                                                                                                                          |         data_quality_job_id          |                                                       data_quality_job_configuration                                                        | job_labels |   job_start_time    |    job_end_time     |                                job_quality_result                                 |                                 job_dimension_result                                  | job_rows_scanned | rule_name | rule_description |  rule_type  | rule_evaluation_type | rule_column | rule_dimension | rule_threshold_percent |        rule_parameters         | rule_passed | rule_rows_evaluated | rule_rows_passed | rule_rows_passed_percent | rule_rows_null |                                                                                                        rule_failed_records_query                                                                                                         |     created_on      |    last_updated     | rule_assertion_row_count | debug_queries | rule_attributes | rule_source | rule_suspended |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+------------+---------------------+---------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+------------------+-----------+------------------+-------------+----------------------+-------------+----------------+------------------------+--------------------------------+-------------+---------------------+------------------+--------------------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+--------------------------+---------------+-----------------+-------------+----------------+
| {"resource_name":"//dataplex.googleapis.com/projects/559412330307/locations/europe-west4/dataScans/customer-orders-data-quality-job","project_id":"qwiklabs-gcp-00-e7f0a808026e","location":"europe-west4","data_scan_id":"customer-orders-data-quality-job","display_name":null} | {"resource_name":"//bigquery.googleapis.com/projects/qwiklabs-gcp-00-e7f0a808026e/datasets/customers/tables/contact_info","dataplex_entity_project_id":null,"dataplex_entity_project_number":null,"dataplex_lake_id":null,"dataplex_zone_id":null,"dataplex_entity_id":null,"table_project_id":"qwiklabs-gcp-00-e7f0a808026e","table_project_number":"559412330307","dataset_id":"customers","table_id":"contact_info","catalog_id":null,"namespace_id":null} | d0c1e246-3f04-4a32-bcac-7bbeeb46c071 | {"enable_catalog_based_rules":false,"increment_column":"","incremental":false,"row_filter":"","sampling_percent":100,"trigger":"on_demand"} |       NULL | 2026-05-12 04:49:34 | 2026-05-12 04:50:03 | {"passed":"false","score":"50.0","incremental_start":null,"incremental_end":null} | {"COMPLETENESS":{"passed":false,"score":0},"CONFORMANCE":{"passed":true,"score":100}} |              100 |           |                  | NULL check  | Per row              | id          | COMPLETENESS   |                  100.0 |                           NULL |       false |                 100 |               90 |                     90.0 |             10 | WITH `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` AS (SELECT * FROM `qwiklabs-gcp-00-e7f0a808026e.customers.contact_info` ) SELECT * FROM `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` WHERE (`id` IS NULL);                                         | 2026-05-12 04:48:46 | 2026-05-12 04:48:46 |                     NULL |            [] |            NULL |        NULL |          false |
| {"resource_name":"//dataplex.googleapis.com/projects/559412330307/locations/europe-west4/dataScans/customer-orders-data-quality-job","project_id":"qwiklabs-gcp-00-e7f0a808026e","location":"europe-west4","data_scan_id":"customer-orders-data-quality-job","display_name":null} | {"resource_name":"//bigquery.googleapis.com/projects/qwiklabs-gcp-00-e7f0a808026e/datasets/customers/tables/contact_info","dataplex_entity_project_id":null,"dataplex_entity_project_number":null,"dataplex_lake_id":null,"dataplex_zone_id":null,"dataplex_entity_id":null,"table_project_id":"qwiklabs-gcp-00-e7f0a808026e","table_project_number":"559412330307","dataset_id":"customers","table_id":"contact_info","catalog_id":null,"namespace_id":null} | d0c1e246-3f04-4a32-bcac-7bbeeb46c071 | {"enable_catalog_based_rules":false,"increment_column":"","incremental":false,"row_filter":"","sampling_percent":100,"trigger":"on_demand"} |       NULL | 2026-05-12 04:49:34 | 2026-05-12 04:50:03 | {"passed":"false","score":"50.0","incremental_start":null,"incremental_end":null} | {"COMPLETENESS":{"passed":false,"score":0},"CONFORMANCE":{"passed":true,"score":100}} |              100 |           |                  | Regex check | Per row              | email       | CONFORMANCE    |                   85.0 | {"regex":"^[^@]+[@]{1}[^@]+$"} |        true |                  95 |               85 |                89.473684 |              5 | WITH `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` AS (SELECT * FROM `qwiklabs-gcp-00-e7f0a808026e.customers.contact_info` ) SELECT * FROM `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` WHERE (NOT(REGEXP_CONTAINS(`email`, r'^[^@]+[@]{1}[^@]+$'))); | 2026-05-12 04:48:46 | 2026-05-12 04:48:46 |                     NULL |            [] |            NULL |        NULL |          false |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+------------+---------------------+---------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+------------------+-----------+------------------+-------------+----------------------+-------------+----------------+------------------------+--------------------------------+-------------+---------------------+------------------+--------------------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+--------------------------+---------------+-----------------+-------------+----------------+

========================================================
Task 5. Review data quality results in BigQuery
========================================================

πŸ‘‰  List datasets:
BigQuery error in ls operation: Not found: Dataset qwiklabs-
gcp-00-e7f0a808026e:qwiklabs-gcp-00-e7f0a808026e

πŸ‘‰  List tables in dataset customers_dq_dataset:
   tableId     Type                              Labels                                   Time Partitioning        Clustered Fields  
 ------------ ------- ------------------------------------------------------------- ----------------------------- ------------------ 
  dq_results   TABLE   goog-dataplex-datascan-export-table-schema-version:1_6_0      DAY (field: job_start_time)                     
                       goog-drz-dataplex-uuid:2c44d5e2-1193-4691-bee6-9e1b40bf196d                                                   
                       goog-drz-dataplex-location:europe-west4                                                                       

πŸ‘‰  Preview dq_results table
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+------------+---------------------+---------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+------------------+-----------+------------------+-------------+----------------------+-------------+----------------+------------------------+--------------------------------+-------------+---------------------+------------------+--------------------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+--------------------------+---------------+-----------------+-------------+----------------+
|                                                                                                                                 data_quality_scan                                                                                                                                 |                                                                                                                                                                                                                          data_source                                                                                                                                                                                                                          |         data_quality_job_id          |                                                       data_quality_job_configuration                                                        | job_labels |   job_start_time    |    job_end_time     |                                job_quality_result                                 |                                 job_dimension_result                                  | job_rows_scanned | rule_name | rule_description |  rule_type  | rule_evaluation_type | rule_column | rule_dimension | rule_threshold_percent |        rule_parameters         | rule_passed | rule_rows_evaluated | rule_rows_passed | rule_rows_passed_percent | rule_rows_null |                                                                                                        rule_failed_records_query                                                                                                         |     created_on      |    last_updated     | rule_assertion_row_count | debug_queries | rule_attributes | rule_source | rule_suspended |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+------------+---------------------+---------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+------------------+-----------+------------------+-------------+----------------------+-------------+----------------+------------------------+--------------------------------+-------------+---------------------+------------------+--------------------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+--------------------------+---------------+-----------------+-------------+----------------+
| {"resource_name":"//dataplex.googleapis.com/projects/559412330307/locations/europe-west4/dataScans/customer-orders-data-quality-job","project_id":"qwiklabs-gcp-00-e7f0a808026e","location":"europe-west4","data_scan_id":"customer-orders-data-quality-job","display_name":null} | {"resource_name":"//bigquery.googleapis.com/projects/qwiklabs-gcp-00-e7f0a808026e/datasets/customers/tables/contact_info","dataplex_entity_project_id":null,"dataplex_entity_project_number":null,"dataplex_lake_id":null,"dataplex_zone_id":null,"dataplex_entity_id":null,"table_project_id":"qwiklabs-gcp-00-e7f0a808026e","table_project_number":"559412330307","dataset_id":"customers","table_id":"contact_info","catalog_id":null,"namespace_id":null} | d0c1e246-3f04-4a32-bcac-7bbeeb46c071 | {"enable_catalog_based_rules":false,"increment_column":"","incremental":false,"row_filter":"","sampling_percent":100,"trigger":"on_demand"} |       NULL | 2026-05-12 04:49:34 | 2026-05-12 04:50:03 | {"passed":"false","score":"50.0","incremental_start":null,"incremental_end":null} | {"COMPLETENESS":{"passed":false,"score":0},"CONFORMANCE":{"passed":true,"score":100}} |              100 |           |                  | NULL check  | Per row              | id          | COMPLETENESS   |                  100.0 |                           NULL |       false |                 100 |               90 |                     90.0 |             10 | WITH `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` AS (SELECT * FROM `qwiklabs-gcp-00-e7f0a808026e.customers.contact_info` ) SELECT * FROM `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` WHERE (`id` IS NULL);                                         | 2026-05-12 04:48:46 | 2026-05-12 04:48:46 |                     NULL |            [] |            NULL |        NULL |          false |
| {"resource_name":"//dataplex.googleapis.com/projects/559412330307/locations/europe-west4/dataScans/customer-orders-data-quality-job","project_id":"qwiklabs-gcp-00-e7f0a808026e","location":"europe-west4","data_scan_id":"customer-orders-data-quality-job","display_name":null} | {"resource_name":"//bigquery.googleapis.com/projects/qwiklabs-gcp-00-e7f0a808026e/datasets/customers/tables/contact_info","dataplex_entity_project_id":null,"dataplex_entity_project_number":null,"dataplex_lake_id":null,"dataplex_zone_id":null,"dataplex_entity_id":null,"table_project_id":"qwiklabs-gcp-00-e7f0a808026e","table_project_number":"559412330307","dataset_id":"customers","table_id":"contact_info","catalog_id":null,"namespace_id":null} | d0c1e246-3f04-4a32-bcac-7bbeeb46c071 | {"enable_catalog_based_rules":false,"increment_column":"","incremental":false,"row_filter":"","sampling_percent":100,"trigger":"on_demand"} |       NULL | 2026-05-12 04:49:34 | 2026-05-12 04:50:03 | {"passed":"false","score":"50.0","incremental_start":null,"incremental_end":null} | {"COMPLETENESS":{"passed":false,"score":0},"CONFORMANCE":{"passed":true,"score":100}} |              100 |           |                  | Regex check | Per row              | email       | CONFORMANCE    |                   85.0 | {"regex":"^[^@]+[@]{1}[^@]+$"} |        true |                  95 |               85 |                89.473684 |              5 | WITH `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` AS (SELECT * FROM `qwiklabs-gcp-00-e7f0a808026e.customers.contact_info` ) SELECT * FROM `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` WHERE (NOT(REGEXP_CONTAINS(`email`, r'^[^@]+[@]{1}[^@]+$'))); | 2026-05-12 04:48:46 | 2026-05-12 04:48:46 |                     NULL |            [] |            NULL |        NULL |          false |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+------------+---------------------+---------------------+-----------------------------------------------------------------------------------+---------------------------------------------------------------------------------------+------------------+-----------+------------------+-------------+----------------------+-------------+----------------+------------------------+--------------------------------+-------------+---------------------+------------------+--------------------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------+--------------------------+---------------+-----------------+-------------+----------------+

e.com    | Charlestown    | Salford         | M6  | UK      | 53.49719989 |  -2.303323438 |
| 2022-08-06 11:58:25 | NULL | Adrian     | Tolbert   |  33 | NULL                       | Aspatria       | Allerdale       | CA7 | UK      | 54.81554267 |  -3.232825304 |
| 2022-02-11 16:48:25 | NULL | David      | Williams  |  47 | david.williams@example.com | Felsted        | Uttlesford      | CM6 | UK      |  51.8746987 |  0.3805200191 |
| 2022-11-21 19:36:13 | NULL | Max        | Leffler   |  47 | max.leffler@example.com    | Lemsford       | Welwyn Hatfield | AL8 | UK      | 51.79967448 |   -0.20798429 |
+---------------------+------+------------+-----------+-----+----------------------------+----------------+-----------------+-----+---------+-------------+---------------+

πŸ‘‰  Click the link to run the query in BigQuery:
https://console.cloud.google.com/bigquery?project=qwiklabs-gcp-00-e7f0a808026e

WITH `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` AS (SELECT * FROM `qwiklabs-gcp-00-e7f0a808026e.customers.contact_info` ) SELECT * FROM `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` WHERE (`id` IS NULL);

Ready to proceed?
 (y/n): 









        y

Lostock          | Bolton                    | BL6 | UK      | 53.59720726 |  -2.540022221 |
| 2021-01-14 12:17:11 | 21849 | Adam       | Neuman    |  36 | adam.neuman    | Weaste           | Salford                   | M5  | UK      | 53.48168705 |  -2.281726773 |
| 2020-06-14 19:32:53 |  8081 | Joseph     | Chavez    |  63 | example.com    | Water Orton      | North Warwickshire        | B46 | UK      | 52.50129443 |  -1.705245292 |
| 2022-02-15 22:37:14 | 55900 | Duane      | King      |  14 | duane          | Wythall          | Bromsgrove Worcestershire | B47 | UK      |  52.3907419 |  -1.876981092 |
+---------------------+-------+------------+-----------+-----+----------------+------------------+---------------------------+-----+---------+-------------+---------------+

πŸ‘‰  Click the link to run the query in BigQuery:
https://console.cloud.google.com/bigquery?project=qwiklabs-gcp-00-e7f0a808026e

WITH `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` AS (SELECT * FROM `qwiklabs-gcp-00-e7f0a808026e.customers.contact_info` ) SELECT * FROM `d0c1e246-3f04-4a32-bcac-7bbeeb46c071` WHERE (NOT(REGEXP_CONTAINS(`email`, r'^[^@]+[@]{1}[^@]+$')));

Ready to proceed?
 (y/n): 









        y

βœ…  All done
student_00_efb3c5f88f66@cloudshell:~ (qwiklabs-gcp-00-e7f0a808026e)$ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment