
Your ETL Job Succeeded. Can You Trust the Data?
A successful ETL run does not guarantee a reliable dataset. Explore how data contracts, validation rules, anomaly detection, and quality gates can prevent incomplete, inconsistent, and misleading data from reaching analytics dashboards and machine learning systems.
Imagine a daily sales pipeline that runs every morning.
The extraction completes. Transformations execute without errors. The output files are written to Amazon S3. The orchestration workflow reports success.
The analytics dashboard refreshes.
But something is wrong.
One region has disappeared from the latest dataset. A source system changed a column's data type. Several records contain invalid timestamps. The total number of transactions has unexpectedly dropped by 40%.
Nothing crashed.
The pipeline did exactly what it was programmed to do.
Yet the resulting dataset is unreliable.
This is an important distinction in data engineering: pipeline execution success is not the same as data quality success.
A production data pipeline should not only move and transform data. It should establish whether the resulting data is fit for its intended use.
1. The hidden cost of trusting successful pipelines
Most pipeline monitoring begins with operational signals:
- Did the job start?
- Did it finish?
- Did it produce an output?
- How long did execution take?
- Did any task return an exception?
These questions are necessary, but insufficient.
A pipeline can successfully process incomplete source data. It can accept duplicate records, silently convert invalid values, or produce an output with missing business entities.
Consider a customer analytics pipeline.
The source system normally delivers 100,000 customer records every day. One morning, an upstream extraction issue delivers only 61,000 records.
The ETL job reads the available records, transforms them, and writes the output.
From the orchestration system's perspective, execution succeeded.
From the business perspective, the dataset may be seriously incomplete.
If the dashboard uses this data without validation, stakeholders might interpret the decline as a real reduction in customer activity.
The issue is not necessarily in the transformation code. It may have originated much earlier in the data lifecycle.
This is why data quality needs to be treated as an explicit engineering responsibility.
2. Think about data quality in multiple dimensions
Data quality is not a single Boolean property.
A dataset can have valid column types but contain incorrect values. It can contain unique records but be missing an entire business region.
I find it useful to evaluate data across six dimensions.
Completeness
Are the required values present?
For example:
- Customer IDs should not be null.
- Transaction amounts should be available.
- Required timestamps should be populated.
Uniqueness
Are records duplicated where uniqueness is expected?
For example, a transaction identifier should not appear multiple times in a dataset representing individual transactions.
Validity
Do values satisfy expected formats and constraints?
Examples include valid email formats, positive transaction quantities, and dates within an acceptable range.
Consistency
Do related fields and datasets agree?
For example, a transaction should reference an existing customer, and its currency should be compatible with the associated financial records.
Freshness
Is the data recent enough for its intended purpose?
A dataset refreshed successfully yesterday may still be unsuitable for a dashboard that requires near-real-time information.
Accuracy
Does the data correctly represent the underlying real-world event?
This is particularly challenging because a value can satisfy every technical validation rule and still be factually wrong.
A positive transaction amount may be valid in format but incorrect because the source system recorded the wrong amount.
These dimensions should be selected according to the business context. Not every dataset requires the same validation rules.
3. Introduce data contracts before transformation
A useful way to prevent quality problems is to define expectations before processing begins.
This is where data contracts become valuable.
A data contract describes the assumptions that producers and consumers make about a dataset.
It can define:
- expected columns and data types;
- required and optional fields;
- uniqueness constraints;
- acceptable value ranges;
- schema compatibility expectations;
- freshness requirements;
- ownership and change-management responsibilities.
For example, consider a transaction dataset:
{ "transaction_id": "TXN-10482", "customer_id": "CUST-208", "transaction_amount": 1499.00, "currency": "INR", "transaction_timestamp": "2026-10-30T10:15:00Z"}A corresponding contract might specify:
-
transaction_idmust be present and unique.
-
customer_idmust reference a valid customer.
-
transaction_amountmust be non-negative.
-
currencymust belong to the supported currency set.
-
transaction_timestampmust use the expected timestamp format.
The contract creates a shared understanding between the system producing the data and the systems consuming it.
This becomes especially useful when multiple teams own different parts of a data platform.
An upstream schema change should be treated as a compatibility event, not something downstream pipelines discover accidentally after deployment.
4. Build quality gates into the pipeline
Defining expectations is only the first step. They need to be evaluated at the right stages.
A practical pipeline might look like this:
Source Systems | vData Ingestion | vSchema Validation | vData Profiling | vTransformation | vBusiness Rule Validation | vQuality Decision | +---- PASS ----> Curated Dataset | +---- FAIL ----> Quarantine / Investigation | vMonitoring and ReportingDifferent validation stages catch different problems.
At ingestion: Check schema compatibility, required fields, file integrity, and expected source availability.
After transformation: Validate business rules, derived values, and relationships between columns.
Before publication: Check completeness, freshness, expected record counts, and referential integrity.
The most important design decision is what happens when a rule fails.
A validation system that only reports failures while allowing every dataset to be published may provide visibility without actually protecting downstream consumers.
For critical datasets, a failed quality gate should prevent publication.
For less critical issues, the pipeline might publish valid records while quarantining invalid ones.
The appropriate response depends on the impact of incorrect data.
5. Implementing data quality checks with AWS Glue
AWS Glue provides a useful foundation for implementing this approach.
AWS Glue Data Quality allows engineers to define validation rules using Data Quality Definition Language (DQDL) and evaluate those rules against datasets in the AWS Glue Data Catalog.
For example, a simplified ruleset could look like:
Rules = [ IsComplete "transaction_id", IsUnique "transaction_id", IsComplete "customer_id", ColumnValues "transaction_amount" >= 0, IsComplete "transaction_timestamp"]These checks evaluate different aspects of the transaction dataset.
A production ruleset would also need appropriate data types, business-specific constraints, and validation of relationships between datasets.
AWS Glue Data Quality supports multiple rule types, including completeness, uniqueness, referential integrity, schema checks, and dataset comparisons.
It can also identify records that fail applicable row-level rules.
This is useful because knowing that a dataset failed validation is only the beginning. Engineers also need to understand which records caused the failure.
AWS Glue Studio provides an Evaluate Data Quality transform that can be integrated into ETL jobs. Depending on the configured actions, results can be published to Amazon CloudWatch and Amazon EventBridge, and jobs can be configured to fail when quality rules are not satisfied.
This allows validation to become part of the pipeline rather than a separate manual review.
6. Static rules are not enough: detect unexpected changes
One challenge with traditional validation is that fixed thresholds can become outdated.
Suppose a retail dataset normally contains approximately 80,000 transactions per day.
An engineer might create a rule requiring at least 70,000 records.
That rule works initially.
But over time, the business expands and daily transaction volume grows to 200,000.
A fixed threshold no longer represents normal behavior.
The opposite problem can also occur: a pipeline may experience a substantial drop in volume while still satisfying the original threshold.
This is where anomaly detection becomes useful.
Instead of evaluating only whether a value satisfies a predefined limit, anomaly detection compares observed behavior with historical patterns.
Examples include:
- unexpected changes in daily record counts;
- unusual distributions of transaction amounts;
- shifts in null-value percentages;
- changes in category frequencies;
- unexpected variations in dataset characteristics.
AWS Glue Data Quality includes anomaly detection and dynamic rules that can use historical statistics to identify deviations.
However, an anomaly should not automatically be interpreted as an error.
A sudden increase in sales could be caused by a genuine seasonal event, a successful campaign, or an operational issue.
The system should identify the deviation and provide enough context for an engineer to investigate it.
The goal is to distinguish unexpected behavior from incorrect data.
7. Do not discard every invalid record
A common mistake in data pipelines is to treat data quality failures as a reason to reject an entire dataset.
That may be appropriate for certain critical failures, but not for every invalid record.
Consider a dataset containing one million transactions, of which 200 have malformed optional metadata.
Rejecting the entire dataset could delay an important reporting workflow unnecessarily.
A better design separates validation outcomes into categories.
Critical failures
Examples:
- missing primary identifiers;
- incompatible schema changes;
- invalid financial values;
- broken mandatory relationships.
These may justify blocking publication.
Recoverable failures
Examples:
- malformed optional metadata;
- records with non-critical formatting issues;
- invalid values that can be safely normalized.
These may be handled through controlled transformations.
Suspicious records
Examples:
- unusually high transaction values;
- unexpected customer activity;
- sudden changes in category distribution.
These should be flagged for investigation rather than automatically deleted.
A quarantine location in Amazon S3 can preserve rejected records for diagnosis and controlled reprocessing.
This approach maintains data lineage and prevents silent data loss.
It also makes quality failures easier to investigate because engineers can inspect the actual records that violated the rules.
8. Make data quality observable
A pipeline dashboard should communicate more than whether the latest job completed.
I would monitor several categories of signals.
Pipeline health
- execution status;
- processing duration;
- ingestion latency;
- failed job count.
Dataset quality
- total records processed;
- records passed and failed;
- duplicate rate;
- completeness percentage;
- schema changes;
- freshness violations.
Historical behavior
- daily record-count trends;
- quality score trends;
- anomaly frequency;
- recurring failed rules.
AWS Glue Data Quality can publish quality metrics to CloudWatch, where teams can build alarms and dashboards.
EventBridge can also be used to react to relevant quality events.
For example, a failed validation could trigger a notification or initiate an investigation workflow.
The important point is that quality metrics should be connected to operational decisions.
A dashboard showing a quality score of 95% is not particularly useful unless engineers understand which rules failed and how those failures affect downstream consumers.
A high aggregate score can also hide a critical failure.
For instance, a dataset may pass nine minor checks while failing the one rule that guarantees transaction identifiers are unique.
Critical rules should therefore have their own enforcement policies rather than relying entirely on an average quality score.
9. Why this matters for machine learning
Data quality becomes even more important when datasets are used for machine learning.
A model can train successfully on a dataset containing systematic errors.
The training job may complete. The loss may decrease. Evaluation metrics may even appear reasonable.
Yet the model could be learning from duplicated examples, incorrect labels, inconsistent feature definitions, or leakage between training and evaluation data.
Consider a binary classification dataset.
If the positive class is accidentally duplicated during an ETL operation, the model may learn a distorted class distribution.
If timestamps are incorrectly parsed, time-dependent features may become unreliable.
If a customer identifier appears in both training and test data when the evaluation is intended to measure generalization to unseen customers, the reported performance may be misleading.
This creates a chain of dependencies:
Source Data Quality | vFeature Quality | vTraining Data Quality | vModel Evaluation | vProduction PredictionsA problem introduced at the data layer can affect every downstream stage.
For ML systems, validation should therefore include not only schema and value checks, but also label consistency, feature distributions, split integrity, and leakage prevention.
A successful model-training run does not establish that the training dataset was appropriate.
10. A practical implementation strategy
For teams starting to introduce data quality engineering, I would avoid building an extensive validation framework immediately.
Start with the datasets that have the greatest downstream impact.
A practical sequence is:
Step 1: Identify critical datasets
List the datasets used by dashboards, business reports, and machine learning models.
Step 2: Define expectations
Document required columns, valid ranges, uniqueness constraints, relationships, and freshness requirements.
Step 3: Implement validation
Introduce schema checks, completeness checks, uniqueness checks, and business rules at appropriate pipeline stages.
Step 4: Define failure behavior
Decide which failures block publication, which can be quarantined, and which only require warnings.
Step 5: Establish observability
Publish quality results and monitor trends over time.
Step 6: Introduce anomaly detection
Once sufficient historical data is available, identify unexpected changes that fixed rules may miss.
Step 7: Connect quality to downstream systems
Prevent critical failures from silently reaching analytics and machine learning workflows.
The objective is not to maximize the number of validation rules.
It is to protect the decisions and systems that depend on the data.
Conclusion
A data pipeline is not reliable simply because its jobs finish successfully.
Reliable data engineering requires explicit expectations, continuous validation, meaningful failure handling, and visibility into how dataset quality changes over time.
AWS Glue Data Quality provides useful building blocks for implementing these practices, while Amazon S3, CloudWatch, and EventBridge can support storage, monitoring, and automated responses.
But the broader engineering principle applies regardless of the technology stack:
A successful pipeline proves that data was processed. Quality validation provides evidence that the resulting data can be trusted.
For analytics teams, that means more dependable reporting.
For machine learning teams, it means more defensible training and evaluation datasets.
And for production systems, it means fewer decisions based on data that looked correct simply because no job failed.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article