Prepare and test your skills

Prepare and test your skills

Visual profiling and governance in Google Cloud is the practice of inspecting data before it is trusted and then enforcing rules that keep it clean over time. Knowledge Catalog, the Dataplex-based governance platform, centralizes this work by letting teams discover, manage, monitor, and govern data and AI artifacts across data platforms. Data flows from collection through storage and transformation into analytical consumption, and the governance layer sits alongside that flow to monitor data flows, transformations, and access. This approach protects validity and quality and supports consistency, reliability, and integrity of downstream models and analytics.
Visual data profiling with Knowledge Catalog is the generation of data profiles that describe formats, ranges, distributions, and completeness before analytical use. A data profile summarizes what the data looks like, so missing values, outliers, skewed distributions, and unexpected formats become visible before training or reporting. Knowledge Catalog manages both data profiles and data quality checks, and BigQuery (opens in a new tab) provides column-level lineage to show which source columns contributed to each profiled field. Because profiling happens before consumption, teams can verify formats, ranges, and distributions and remove or correct defects early.
Profiling for cleansing also defends against inconsistent or malicious change in pipelines. Comprehensive monitoring and alerting is configured for data pipelines and machine learning (ML) pipelines to track inconsistent behavior, unexpected transformation, or unexpected access to data. To detect anomalies in training data that might indicate data poisoning, BigQuery anomaly detection uses statistical methods or ML models. Human review complements automation by analyzing evaluation metrics and applying domain expertise to identify suspicious patterns that automated methods might miss.
Automated data quality in Knowledge Catalog is the use of built-in checks to validate integrity continuously rather than by one-time inspection. Validation checks verify data formats, ranges, and distributions before data is used for training, which prevents invalid or poisoned records from moving downstream. The governance platform manages those data quality checks centrally, so the same rule definition applies wherever the governed table or artifact is discovered and used. This central control plane manages policy while the underlying platforms in BigQuery, data lakes, and lakehouses store and process the data.
Knowledge Catalog extends quality governance with rich metadata controls:
Continuous monitoring for compliance is the capture of logs, metrics, and audit trails about data access and manipulation with alerting on deviation. Cloud Logging (opens in a new tab) captures real-time logs from data pipelines, Cloud Monitoring collects metrics and alerting signals, and Cloud Audit Logs collect audit trails of API calls. Logs help teams audit data access, detect unauthorized access attempts, and prevent unwanted access, but pipelines must not log personally identifiable information (PII) or confidential data in experiments or log servers. Together, the pipeline depends on Logging for visibility, Monitoring for alerting, and Audit Logs for accountability.
This monitoring boundary separates trusted governance operations from untrusted data change. Training data poses the largest risk for bias and leakage, so the governance layer monitors collection, storage, and transformation across teams. When a quality rule fails, a distribution shifts, or access deviates from expected patterns, alerts route to the responsible owners for review. The result is ongoing compliance where quality is re-verified on every pipeline run and transformation, not only checked once during cleansing.
Exam tip: In Knowledge Catalog, a data profile describes what the data looks like to reveal anomalies, while an automatic data quality rule verifies formats, ranges, and distributions to block bad data before training.
Cloud Dataflow (opens in a new tab) is a fully managed, serverless service for running Apache Beam pipelines at scale with unified stream and batch processing. A Dataflow pipeline reads from one or more sources, transforms the data, and writes the data to a destination, and Apache Beam lets teams apply the same transform logic to bounded batch data and unbounded streaming data. For data cleansing, that read-transform-write shape means validation and filtering live inside the transform stage where clean records continue to the analytical sink while corrupt records are diverted to a separate auditing sink without stopping the job.
Apache Beam pipelines in Dataflow use the same programming model for batch and streaming analytics, so one cleansing design can serve historical backfills and real-time feeds. Streaming pipelines can achieve low latency while ingesting, processing, and analyzing fluctuating volumes of real-time data, and batch pipelines process bounded sources such as files in Cloud Storage or tables in BigQuery. Unbounded sources are often converted to bounded chunks for task-style processing, then pre-processed into a shape and encoding that downstream validation and enrichment can use. Performance, scaling, availability, security, and compliance are handled automatically, so developers focus on pipeline code rather than managing worker clusters.
Dataflow provides two streaming correctness modes that change how cleansing handles duplicates:
| Mode | Guarantee | Cost and latency | Choose when |
|---|---|---|---|
| Exactly-once processing | Every record is processed exactly once by default | Higher cost and latency to enforce the guarantee | Analytical results must not contain duplicates from retries |
| At-least-once mode | Records may be delivered more than once | Lower cost and improved latency | The streaming pipeline can tolerate duplicates |
Filtering in Dataflow is a transform between managed sources and managed sinks in the ordered flow from ingestion to storage. The pipeline pulls events from a durable ingestion service such as Pub/Sub (opens in a new tab), applies parsing, validation, and enrichment, and writes trusted output to destinations such as BigQuery (opens in a new tab) for warehousing, Cloud Storage for lake storage, or Bigtable for high-throughput serving. Using Google Cloud managed sources and sinks removes capacity-management complexity because those services provide built-in scalability, consistent performance, and quotas that accommodate most requirements. Apache Beam also supplies source and sink connectors, including BigQueryIO, so the same cleansing pipeline can read and write across Pub/Sub, BigQuery, and Cloud Storage without custom I/O code.
Validation that calls outside systems needs extra care because Dataflow parallelizes work across many workers. Calling external services from a transform incurs per-call overhead, so batching multiple elements into single requests is preferred, a pattern that native Beam I/O transforms such as BigQueryIO and streaming inserts already perform. Too much parallel traffic can overwhelm an external validation service or exhaust daily or per-second quotas, and autoscaling can make the pressure worse by adding workers to a slow external-call step. Limiting batch sizes and concurrent calls keeps the cleansing stage sustainable under autoscaling.
Isolating bad records in Dataflow is the split of transform output into a clean path and a quarantine path that keeps the job running. Valid records flow from the transform stage to the primary analytical sink, while malformed, incomplete, or schema-violating records flow to a separate dead-letter sink such as a Pub/Sub topic, a Cloud Storage prefix, or a BigQuery quarantine table for auditing and reprocessing. That separation prevents one corrupt event from failing the whole job and preserves the original bad payload plus the validation error for later inspection, correction, and replay. The same branching idea appears in Cloud Data Fusion as error-collector and alert-publisher plugins, which shows the broader Google Cloud pattern of routing failures to dedicated collectors rather than dropping them silently.
An end-to-end cleansing pipeline follows an ordered flow from ingestion through quarantine:
Pub/Sub strengthens this design because a subscription stores unacknowledged messages for up to 7 days, so delayed data can buffer in the subscription while pipelines are stopped and then be processed with low data loss when workers restart.
Operability in Dataflow comes from managed execution, observability, and flexible deployment of continuously running jobs. When a Dataflow job runs, the service allocates a pool of Compute Engine worker virtual machines, distributes data in parallel, autoscales workers up or down, dynamically rebalances work among workers, and deletes the workers when the job completes or is cancelled. The work therefore survives slow workers and worker failures through built-in mechanisms:
Deployment and security controls determine where and how the cleansing job runs. Teams can write code with the Java, Python, or Go SDKs, deploy a Dataflow template for repeatable execution, or iterate in JupyterLab notebooks, and multi-language pipelines allow mixing SDKs when needed. Worker placement is controlled by regional endpoint, worker region, and worker zone settings, so sources, sinks, and temporary files should sit in the job region to avoid sending data across regions. Customer-managed encryption keys, virtual private cloud networks, and firewall rules protect pipeline state and data in motion while preserving the autoscaling and exactly-once behavior that cleansing depends on.
Post-ingestion deduplication and standardization in BigQuery (opens in a new tab) is the practice of loading raw data into a staging table and then using BigQuery itself to clean, conform, and write trusted output to a final production table. Data flows from extract-and-load sources into the staging table, then through SQL queries that enforce types, formats, and consistency rules, then into the production table that serves analytics. This extract, load, and transform (ELT) pattern keeps heavy cleansing close to petabyte-scale storage while preserving a repeatable lineage from raw input to curated output.
Post-ingestion validation in BigQuery verifies that loaded records match the expected schema and business rules before analytical consumption. Validation checks confirm that data types, table structures, formats, ranges, and distributions are correctly handled, and test cases compare BigQuery results against source results to expose conversion or structural drift. When mismatches appear, the converted queries and definitions are analyzed and fixed before the data is promoted to production.
BigQuery validation combines code-level checks with managed quality services:
The script checks enforce row-level constraints at transform time, while Knowledge Catalog manages data quality checks, data profiles, and column-level lineage for ongoing governance. Because BigQuery also provides column-level lineage, a failed format or distribution check can be traced from the production table back through the transform to the staging source.
Standardization at scale in BigQuery uses SQL transforms, stored procedures, and physical layout controls to apply the same cleansing logic efficiently across very large datasets. BigQuery supports SQL for stored procedures and SQL user-defined functions (UDFs) that execute inside BigQuery, plus external function calls through Cloud Run functions for logic that cannot be expressed in SQL. For other languages, external functions or client-side application logic carry the custom step while BigQuery retains the set-based SQL transform.
Performance and correctness depend on how the staging and production tables are organized and written. BigQuery supports explicit partitioning and clustering to control how data is distributed and organized, which can improve both cost and runtime performance for cleansing scans, joins, and aggregations used to find duplicates and conform values. Fine-grained data manipulation language (DML) improves latency and throughput for small writes, and materialized views can persist and automatically refresh common SQL computations used for standardized outputs. Data that BigQuery loads is stored synchronously in two zones within the specified region, so the staging-to-production flow retains zonal redundancy during cleansing.
Exam tip: BigQuery runs SQL stored procedures and SQL UDFs inside BigQuery; use external functions through Cloud Run functions or client-side logic for other languages.
Governance for post-ingestion cleansing in BigQuery centrally discovers, manages, monitors, and governs data, transforms, and access across data marts. Knowledge Catalog provides the governance layer for lineage, data discovery, business glossary vocabulary, and metadata enrichment, while BigQuery contributes data governance features that help control access and ensure accuracy and consistency. The governance platform depends on pipeline logs and lineage, so every staging-to-production SQL transform remains auditable for who changed data, when the change occurred, and which artifacts were affected.
Monitoring and access control surround the cleansing flow from ingestion through curated serving. Comprehensive monitoring and alerting for data pipelines tracks inconsistent behavior, unexpected transformation, and unexpected access, supported by Cloud Logging (opens in a new tab), Cloud Monitoring, and Cloud Audit Logs for API and access trails. Access to datasets and resources within datasets is managed with Identity and Access Management (IAM) roles, with finer controls available through row-level security, column-level security, authorized views, and policy tags. Together, validation SQL, governed transforms, and layered access ensure that only cleansed, standardized, and authorized production data reaches analytical consumers.
A data profile in Knowledge Catalog describes what the data looks like to reveal missing values, outliers, skewed distributions and unexpected formats before analytical use, while an automatic data quality rule verifies formats, ranges and distributions to block invalid records before training. Knowledge Catalog manages both profiles and checks centrally so the same rule definition applies wherever the governed table is discovered and used.
Exactly-once processing in Cloud Dataflow processes every record exactly once by default and should be used when analytical results must not contain duplicates from retries, despite its higher cost and latency. At-least-once mode should be used when the streaming pipeline can tolerate duplicates because it offers lower cost and improved latency.
A Cloud Dataflow pipeline splits transform output so valid records flow to the primary analytical sink while malformed, incomplete or schema-violating records flow to a separate dead-letter sink for auditing and reprocessing. The dead-letter sink can be a Pub/Sub topic, a Cloud Storage prefix or a BigQuery quarantine table and preserves the original bad payload plus the validation error for later inspection, correction and replay.
Post-ingestion cleansing in BigQuery loads raw data into a staging table and then uses SQL transforms to clean, conform and write trusted output to a final production table that serves analytics. Standardization uses SQL stored procedures and SQL user-defined functions (UDFs) inside BigQuery with partitioning, clustering and materialized views to apply the same cleansing logic efficiently across very large datasets.
A data engineer is designing an automated post-ingestion cleansing pipeline in BigQuery for a multi-terabyte event ingestion table named telemetry.raw_events.
Due to upstream at-least-once streaming semantics, duplicate event payloads are frequently ingested. The cleansing pipeline must meet the following operational requirements:
device_id and event_id.ingestion_timestamp.Which SQL pattern should the data engineer implement?
Execute a SELECT DISTINCT * query grouped by device_id and event_id, writing the output into a temporary table before dropping and recreating the original table.
Execute a MERGE INTO telemetry.raw_events target USING (SELECT device_id, event_id, MAX(ingestion_timestamp) AS max_time FROM telemetry.raw_events GROUP BY device_id, event_id) source ON target.device_id = source.device_id AND target.event_id = source.event_id WHEN MATCHED AND target.ingestion_timestamp < source.max_time THEN DELETE.
Execute a CREATE OR REPLACE TABLE telemetry.raw_events AS statement querying SELECT * EXCEPT(row_num) FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY device_id, event_id ORDER BY ingestion_timestamp DESC) AS row_num FROM telemetry.raw_events) WHERE row_num = 1.
Execute a DELETE FROM telemetry.raw_events WHERE (device_id, event_id) IN (SELECT (device_id, event_id) FROM telemetry.raw_events GROUP BY device_id, event_id HAVING COUNT(*) > 1).
Last updated