Prepare and test your skills

Prepare and test your skills

Implementing real-time and batch data quality rules means applying checks for completeness, consistency, and correctness at different points in the data lifecycle. Cloud Dataflow (opens in a new tab) enforces per-record checks as data flows through ingestion and preprocessing, while Knowledge Catalog and BigQuery enforce dataset-level checks before data is used for training or analytics. Together they defend against missing data, malformed data, and malicious data such as data poisoning.
Data quality rules validate three dimensions of fitness for purpose. Completeness checks verify that required records, fields, and values are present and that no expected data is missing. Consistency checks verify that data types, formats, and ranges match the expected schema as data moves from sources through transforms to sinks. Correctness checks verify that values and distributions reflect reality, including shifted distributions or injected records that could manipulate model behavior.
Robust validation before training verifies formats, ranges, and distributions together rather than only one dimension. Format and range checks catch malformed or out-of-bound values early, while distribution checks catch subtle drift or poisoning that per-record checks miss. This combination protects the validity, unbiasedness, reliability, and integrity of training data.
Cloud Dataflow is the service for validating streaming and batch data inside ingestion and preprocessing code. Data flows from one or more sources through pipeline transforms to one or more sinks, and validation logic implemented in Python checks data types, formats, and ranges as each record passes through. The pipeline validates and sanitizes inputs and outputs in code, so malformed records and manipulation attempts are blocked before they reach downstream storage or model training.
Real-time validation depends on continuous monitoring of data pipelines and machine learning (ML) pipelines. Cloud Logging captures real-time logs from pipeline code, Cloud Monitoring collects metrics related to pipeline behavior, and Cloud Audit Logs collects audit trails of API calls that created, modified, or read data. A governance layer monitors these data flows, transformations, and access events to audit access, detect unauthorized attempts, and track inconsistent behavior or unexpected transformation.
Streaming validation carries higher operational complexity than batch validation. Continuous deployment can directly launch a batch pipeline as a new Dataflow job, while a streaming pipeline requires a replace-or-update decision and may require coordinating multiple Dataflow jobs to avoid business disruption. Core processing for either mode happens in the region specified for the Dataflow workers, so validation logic runs where the workers run even when sources and sinks are in other regions.
Knowledge Catalog is the centralized governance platform for managing data quality checks and data profiles across data platforms. The platform centrally discovers, manages, monitors, and governs data and artificial intelligence (AI) artifacts, and it provides access to trusted users for exploration and processing. Its governed capabilities include:
Automatic data quality in Knowledge Catalog verifies integrity at scale without hand-writing every rule. BigQuery complements those checks with anomaly detection using statistical methods or ML models, which detects anomalies in training data that might indicate data poisoning. Vertex AI Feature Store extends batch monitoring to features and feature groups by scheduling monitoring that tracks shifts after ingestion.
Exam tip: Use Dataflow Python checks for per-record type, format, and range validation in flight, and use Knowledge Catalog automatic data quality plus BigQuery anomaly detection for distribution and anomaly validation across the full dataset.
Streaming validation minimizes the time between bad data arriving and detection, while batch validation maximizes the context available for judging correctness. Streaming checks see one record or window at a time, so they excel at completeness and consistency but cannot judge a full distribution. Batch checks see the whole table, profile, or feature set, so they excel at distribution, drift, and poisoning detection but act only after data has landed.
| Approach | What it validates best | Operational implication |
|---|---|---|
| Cloud Dataflow streaming validation | Per-record data types, formats, and ranges during ingestion and preprocessing | Faster containment, but streaming updates are more complex and may require parallel jobs |
| Knowledge Catalog and BigQuery batch validation | Completeness across datasets, data profiles, and distributions plus anomalies that suggest poisoning | Broader context before training, and batch jobs can launch directly as new jobs after checks pass |
Choose streaming validation when the business requirement is immediate containment of malformed or malicious events before they propagate to sinks. Choose batch validation when the requirement is fitness for training or reporting, where format, range, and distribution must be verified together and lineage must be recorded for audit and root-cause analysis.
Designing validation pipelines for anomaly detection and monitoring means building automated systems that continuously check data fidelity from ingestion through transformation to serving. The pipeline captures logs and metrics into Cloud Logging and Cloud Monitoring, runs quality and statistical checks to detect drift and outliers, and routes findings through alerting into remediation. This closed loop maintains reliability because every stage from collection to response depends on shared telemetry, versioned results, and defined ownership.
Centralized telemetry gives a validation pipeline its eyes and ears in production. Cloud Logging captures real-time event logs from data pipelines, including file arrivals, transformation errors, and access activity, while Cloud Monitoring collects numerical metrics such as row counts, null rates, latency, throughput, and custom data-quality metrics. Cloud Audit Logs (opens in a new tab) adds an API audit trail that records who called which service to create, modify, or read data, with Admin Activity logs enabled by default and Data Access logs enabled for services such as BigQuery.
Telemetry flows from pipeline components to Cloud Logging and Cloud Monitoring, where log-based metrics convert selected log events into monitorable time series for dashboards and alerts. Do not write personally identifiable information (PII) or confidential values into logs or experiment outputs, and export selected logs to BigQuery for long-term analysis or to a security information and event management (SIEM) system for centralized review.
Automated data quality checks validate that incoming and transformed data matches expected formats, ranges, distributions, and profiles before errors propagate downstream. Knowledge Catalog provides the governance layer that centrally discovers data, manages data lineage including column-level lineage in BigQuery, and runs automatic data-quality checks and data profiles. TensorFlow Data Validation (TFDV) validates ingestion and preprocessing logic and monitors data distributions over time, so shifts in feature distributions that signal data drift become visible as trends in Cloud Monitoring dashboards.
When drift exceeds a threshold, the monitoring signal can automatically trigger a retraining pipeline, while validation results flow into BigQuery for historical tracking and validation artifacts are archived in Cloud Storage. The three validation engines divide work by scale and programmability:
| Engine | Processing model | Choose when |
|---|---|---|
| Knowledge Catalog | Managed governance with automatic quality checks and profiles | The need is continuous, declarative quality monitoring with lineage and discovery across data marts |
| BigQuery | Large-scale SQL-based checks | The need is set-based validation such as completeness, range, and distribution queries over warehouse tables |
| Dataflow | Programmatic batch and streaming validation | The need is complex custom logic on streaming or batch data that SQL alone cannot express |
Use the engines together because a pipeline often depends on all three: Dataflow validates records in flight, BigQuery validates landed tables at scale, and Knowledge Catalog tracks quality history and lineage for audit and root-cause analysis.
Anomaly and outlier detection finds individual records or patterns that deviate from expected behavior, including sudden volume spikes, distribution shifts, and signs of data poisoning. Data poisoning is an attack in which malicious rows are injected into training data to manipulate model behavior or degrade performance, so the validation pipeline must treat unexpected access, transformation changes, and statistical outliers as security-relevant signals. BigQuery anomaly detection applies statistical methods or machine learning models directly to training and serving tables to flag suspicious deviations without moving data to a separate system.
Agent Platform Feature Store extends this monitoring to scheduled checks of features and feature groups, and model monitoring tracks model and data drift metrics such as prediction distribution shifts alongside infrastructure signals like latency and throughput.
Exam tip: Use Cloud Logging to capture what happened as events, Cloud Monitoring to measure how metrics change over time and fire alerts, and Cloud Audit Logs to record who performed the API action.
Alerting and remediation workflows convert detections into reliable action with clear ownership and order of operations. The workflow moves telemetry from detection to response in sequence:
Remediation depends on preserved evidence and lineage to succeed. Validation results stored in BigQuery provide the queryable history that links an alert to the failing batch, while lineage in Knowledge Catalog traces the artifact from source dataset through Dataflow transforms to the served table for debugging. File-level integrity checks using Cloud Storage size and checksum validation, often run by Cloud Run functions on upload events or inside Dataflow, detect corruption or incomplete transfers before downstream checks run.
A data contract is a structured, enforceable agreement between data providers and consumers that defines schema, types, business rules, and allowed use. In Google Cloud, the contract is constructed in BigQuery schemas and Pub/Sub topics and made executable with Data Catalog tags, policy tables, and automated checks that validate, enforce, and audit compliance across pipelines.
BigQuery (opens in a new tab) schemas define the structural half of a data contract through datasets, tables, columns, data types, and storage location. When a dataset is created the location is fixed as regional, such as us-central1, or multi-region, such as US or EU, which controls where data resides and which failure domain applies for availability planning. Because warehouses are often terabytes to petabytes and append-only with static historic data, contracts must also define whether new data is validated incrementally or the full table is revalidated, balancing recovery time and cost.
The Cloud Data Quality Engine runs contract rules against specified table columns and measures correctness and completeness as success percentages against thresholds. Results are written back as Data Catalog tags on the asset, so downstream pipelines and consumers can read contract status from metadata without rescanning the table.
Pub/Sub topics and subscriptions enforce the event half of a data contract as data flows from publishers to subscribers and then to processing. Publishers send messages to a predefined topic, subscribers pull through independent subscriptions, and a subscription can buffer backed-up events when pipelines stop so no contracted events are lost before processing resumes. This buffering gives low recovery point objective, but throughput quotas apply at the project level, so pipelines in separate projects with separate service accounts receive independent publisher and subscriber throughput.
Schema control at ingestion also limits which schemas, tables, and columns are streamed and which are excluded, preventing sensitive or out-of-contract fields from entering the destination. When automated checks detect encryption, de-identification, retention, or quality deviations, findings flow from the validator to operators through Pub/Sub, making Pub/Sub both the data plane for events and the alert plane for contract violations.
Data Catalog tags, in Knowledge Catalog, make the contract discoverable, standardized, and machine-enforceable by attaching provider rules and measured status directly to each asset. Tag Engine applies tags automatically based on data sensitivity and a policy table stored in BigQuery, so business and governance rules defined once in a table propagate consistently to many assets. Built-in lineage then tracks provenance from original source through transforms, while ingestion scripts tag the source system to preserve traceability.
Contract tags cover distinct dimensions that together define fitness for purpose:
These tags do not themselves transform data; the tags store the contract state that BigQuery, Identity and Access Management (IAM), and automation then enforce.
Contract enforcement, monitoring, and audit close the loop from definition to consequence through an ordered lifecycle where each stage depends on the prior stage. First, agreements, assessment requirements, and retention policies are defined in dedicated BigQuery tables. Then Tag Engine and ingestion logic apply the corresponding Data Catalog tags to assets. Then validators check reality against the tags, including automated encryption checks and Data Quality Engine column checks. Only after validation does enforcement act, followed by reporting and audit.
The three layers divide responsibility by where they act:
| Layer | Contract role | Holds | Enforces through |
|---|---|---|---|
| BigQuery | System of record | Agreements, policy tables, audit trail, table data | Schema validation, query-label purpose checks, Record Manager purge or archive |
| Pub/Sub | Event transport and alert bus | Messages in topics, buffered events in subscriptions | Selective schema, table, and column inclusion, plus delivery of violation findings |
| Data Catalog | Governed metadata | Tags for agreement, security, privacy, retention, quality, cost, and lineage | Discovery, standardized vocabulary, and inputs that automation validates against |
Exam tip: A consumer can hold IAM access to a BigQuery table and still be denied when querying sensitive data without a valid query-label purpose that matches their entitlement.
Streaming validation in Cloud Dataflow checks per-record data types, formats, and ranges during ingestion and preprocessing for faster containment, while batch validation in Knowledge Catalog and BigQuery checks completeness, data profiles, distributions, and anomalies across the full dataset before training. Streaming sees one record or window at a time and cannot judge a full distribution, whereas batch sees the whole table and excels at drift and poisoning detection but acts only after data has landed.
Cloud Logging captures real-time event logs such as file arrivals, transformation errors, and access activity, Cloud Monitoring collects numerical metrics such as row counts, null rates, latency, throughput, and custom data-quality metrics and evaluates them against alerting policies, and Cloud Audit Logs records who called which service to create, modify, or read data. Log-based metrics convert selected log events into monitorable time series for dashboards and alerts, while validation results stored in BigQuery provide queryable history and lineage in Knowledge Catalog traces artifacts for debugging.
BigQuery defines schemas and stores agreements, policy tables, and audit trails while enforcing schema validation, query-label purpose checks, and retention purge or archive, and Pub/Sub enforces event schemas with selective table and column inclusion while buffering events in subscriptions and delivering violation findings. Data Catalog tags carry agreement, security, privacy, retention, quality, cost, provenance, and lineage status that automation validates against, and a consumer with Identity and Access Management (IAM) access can still be denied without a valid query-label purpose matching their entitlement.
An enterprise data analytics platform ingests high-frequency transaction records through a distributed data processing pipeline before storing them in Google Cloud databases. During recent production runs, upstream schema mutations and data source drift caused unexpected null distributions and value outliers, degrading downstream analytical fidelity.
You need to design an automated validation and monitoring architecture that accomplishes the following:
Which architecture should you implement?
Last updated