Learn Data Engineering Intermediate

Data Quality, Observability, and Cost Optimization at Scale

Try This First

Test your knowledge before reading. Don't worry if you get it wrong — that's part of learning.

Key Insights

  • Master data quality frameworks (Great Expectations, dbt tests), data observability (freshness, volume, schema, lineage), cost optimization strategies (partitioning, incremental, tiering), feature stores, and building a production observability-driven quality program.
Difficulty: Intermediate Type: Learn

Data Quality: The Foundation of Trustworthy Pipelines

Data quality is not a one-time exercise — it is an ongoing practice embedded into every stage of the data pipeline. Poor data quality costs organizations an estimated 15-25% of revenue and erodes trust in data-driven decision making.

  • Completeness: Are all required fields present? Missing values can indicate source system issues or pipeline failures.
  • Uniqueness: Are there duplicate records? Duplicate detection prevents double-counting in aggregations and reporting.
  • Timeliness: Is the data fresh enough for its intended use? A dashboard that refreshes hourly needs different freshness guarantees than a monthly regulatory report.
  • Validity: Does the data conform to expected formats, types, and ranges? Invalid emails, negative ages, or future dates signal upstream problems.
  • Accuracy: Does the data reflect reality? This is the hardest dimension to measure — it often requires cross-referencing with trusted sources or manual sampling.
  • Consistency: Does the data agree across systems? The same customer name or product code should match across source, warehouse, and BI layer.

Great Expectations: Data Quality as Code

Great Expectations (GX) is the most widely adopted open-source data quality framework. It lets teams define, document, and test data expectations programmatically.

  • Expectations: The core abstraction. An expectation is a declarative, version-controlled statement about your data (e.g., expect_column_values_to_not_be_null("order_id") or expect_column_sum_to_be_between("revenue", 100000, 500000)).
  • Data Docs: Auto-generated HTML documentation showing expectation results, data samples, and pipeline health. Teams can browse data quality reports without writing code.
  • Suites and Checkpoints: An expectation suite groups related expectations for a dataset. A checkpoint runs a suite against a specific batch of data and produces validation results.
  • Integration: GX integrates with dbt (run expectations on dbt models), Airflow/Dagster (as a pipeline step), and most data warehouses via SQLAlchemy or Spark.

A typical Great Expectations workflow:

import great_expectations as gx

context = gx.get_context()
datasource = context.sources.add_spark("my_spark")
data_asset = datasource.add_csv_asset("orders", "s3://data/orders/")
batch = data_asset.get_batch()

Define expectations

batch.expect_column_to_exist("order_id") batch.expect_column_values_to_not_be_null("amount") batch.expect_column_values_to_be_between("amount", 0, 100000) batch.expect_column_mean_to_be_between("amount", 50, 200)

Validate

results = batch.validate() print(f"Passed: {results['statistics']['successful_expectations']}")

Data Observability: Monitoring the Pipeline Health

Data observability extends monitoring to the data itself — not just the infrastructure running the pipeline. It answers five key questions:

  • Freshness: Is the data arriving on time? Track scheduled vs actual arrival times for each table or topic.
  • Volume: Is the expected amount of data arriving? Sudden drops or spikes indicate upstream issues or schema changes.
  • Schema: Has the data structure changed? New columns, removed columns, or type changes must be detected automatically.
  • Quality: Are data quality expectations passing? Track pass/fail rates over time and alert on degradation.
  • Lineage: Where did this data come from, and what downstream reports does it feed? Full column-level lineage enables impact analysis.

Key tools in the observability space:

ToolCategoryKey Features
Monte CarloSaaSAutomated lineage, freshness/volume/schema monitors, Slack integration, incident management
SiffletSaaSColumn-level lineage, root cause analysis, data health scores
OpenLineageOpen sourceStandardized lineage metadata collection, integrates with Airflow/Dagster/Spark
DatadogSaaSInfrastructure + data pipeline monitoring, custom metrics, dashboards
ElementaryOpen sourcedbt-native observability, anomaly detection, data reports in dbt docs

Cost Optimization: Engineering for Efficiency

Data infrastructure costs grow with data volume. Without deliberate optimization, cloud data costs can spiral 30-50% year over year. Here are the key strategies:

  • Partition Pruning: Organize tables by date, region, or other high-cardinality dimensions. Queries that filter on the partition key only scan relevant partitions, reducing cost and improving speed. Tools like Iceberg and Delta Lake support partition evolution — changing the partition scheme without rewriting data.
  • Incremental Processing: Process only new or changed records instead of full-table scans. dbt incremental models, Spark structured streaming with watermarks, and Kafka compacted topics all reduce per-run compute.
  • Storage Tiering: Move cold data to cheaper storage. Use lifecycle policies to transition data from hot (SSD) to warm (HDD) to cold (object store/Glacier) based on access patterns. Iceberg and Delta Lake support storage tiering transparently.
  • Compute Autoscaling: Use serverless or auto-scaling compute to match resources to workload. Snowflake auto-suspend, BigQuery slot reservations, and Spark dynamic allocation prevent over-provisioning.
  • Query Optimization: Identify and fix expensive queries. Use materialized views for frequent aggregations, sort keys/partitioning for common filter patterns, and avoid SELECT * in production pipelines.
  • Data Retention and Purging: Define retention policies per dataset. Raw source data may be retained for 30 days, transformed data for 6 months, and aggregated data indefinitely. Automate purging to prevent storage bloat.

Feature Stores: Quality-Controlled ML Data

Feature stores bridge the gap between data engineering and ML. They provide a centralized registry of features — pre-computed, versioned, and quality-controlled — that ML models consume in both training and inference.

  • Feast: Open-source feature store (LF AI & Data Foundation). Features are defined as Python functions or dbt models, stored in an online store (Redis, DynamoDB) for low-latency serving and an offline store (BigQuery, Snowflake) for training.
  • Tecton: Enterprise feature platform built on Feast's architecture. Adds automated feature engineering, streaming feature computation, point-in-time correctness guarantees, and governance controls.
  • Data Quality Integration: Feature stores enforce quality at the feature level — detecting drift between training and serving data, validating feature value ranges, and alerting on stale or missing features.

Building an Observability-Driven Quality Program

A production-grade data quality program combines multiple layers:

Layer 1: Source Validation (Great Expectations)
- Check completeness, uniqueness, schema at ingestion
- Alert on anomalies before they enter the pipeline

Layer 2: Transformation Quality (dbt tests, Soda)
- Test assumptions after each transformation stage
- Enforce contracts between model layers

Layer 3: Pipeline Health (Dagster + Elementary)
- Track freshness, volume, and run status per asset
- PagerDuty/Slack alerts on failures

Layer 4: Cross-System Observability (Monte Carlo / OpenLineage)
- Column-level lineage from source to dashboard
- Impact analysis for schema changes
- Incident management and root cause analysis

Layer 5: Cost Governance (Budgets + Alerts)
- Track compute and storage cost per team/dataset
- Set budgets and auto-alert on >10% cost increase
- Quarterly review of unused / cold data

The goal is not 100% data quality — that is neither achievable nor cost-effective. Instead, define quality SLOs for each data product based on its criticality. A board-level financial report needs higher quality guarantees than an internal experimentation dataset.

Article Metadata

Review with Spaced Repetition

Add this lesson's 7 flashcards to your SM-2 study queue. They will appear when due in the Study Queue.

Feynman Concept Cards

Master each building block: read the ELI5, explore the analogy, work the example, find your gaps, teach it back, build it.

Data Quality is a concept in best practices. In simple terms, Data Quality covers best practices in Data Engineering. This data engineering concept addresses key topics in the best practices in data engineering domain. Also known as: data observability, data val

Analogy
Think of Data Quality like a maintenance checklist for a power plant — it helps you handle best practices tasks more effectively.
Example
Consider a scenario where Data Quality applies: Data Quality covers best practices in Data Engineering. This data engineering concept addresses key topics in the best practices in data engineering domain. Also known as: data observability, data val...
Find Gaps
What are the key components or steps involved in Data Quality?
Can you explain Data Quality without using jargon?
What happens if Data Quality is not applied correctly?
How does Data Quality relate to other concepts in best practices?
Teach Back

Explain Data Quality as if teaching a colleague who is new to best practices. Cover: what it is, how it works, and why it matters.

Create

Create a checklist that demonstrates Data Quality in a real-world best practices scenario. Walk through your design decisions.

Show solution
A checklist for Data Quality should include: 1. The core components of data quality 2. How they interact 3. Expected outcomes or outputs
Difficulty: Intermediate — 3/5

DataOps is a concept in best practices. In simple terms, DataOps covers best practices in Data Engineering. This data engineering concept addresses key topics in the best practices in data engineering domain. Also known as: DataOps practices, data operation

Analogy
Think of DataOps like a maintenance checklist for a power plant — it helps you handle best practices tasks more effectively.
Example
Consider a scenario where DataOps applies: DataOps covers best practices in Data Engineering. This data engineering concept addresses key topics in the best practices in data engineering domain. Also known as: DataOps practices, data operation...
Find Gaps
What are the key components or steps involved in DataOps?
Can you explain DataOps without using jargon?
What happens if DataOps is not applied correctly?
How does DataOps relate to other concepts in best practices?
Teach Back

Explain DataOps as if teaching a colleague who is new to best practices. Cover: what it is, how it works, and why it matters.

Create

Create a checklist that demonstrates DataOps in a real-world best practices scenario. Walk through your design decisions.

Show solution
A checklist for DataOps should include: 1. The core components of dataops 2. How they interact 3. Expected outcomes or outputs
Difficulty: Advanced — 4/5

Data Observability is a concept in best practices. In simple terms, Data Observability covers best practices in Data Engineering. This data engineering concept addresses key topics in the best practices in data engineering domain. Also known as: data monitoring, data

Analogy
Think of Data Observability like a maintenance checklist for a power plant — it helps you handle best practices tasks more effectively.
Example
Consider a scenario where Data Observability applies: Data Observability covers best practices in Data Engineering. This data engineering concept addresses key topics in the best practices in data engineering domain. Also known as: data monitoring, data ...
Find Gaps
What are the key components or steps involved in Data Observability?
Can you explain Data Observability without using jargon?
What happens if Data Observability is not applied correctly?
How does Data Observability relate to other concepts in best practices?
Teach Back

Explain Data Observability as if teaching a colleague who is new to best practices. Cover: what it is, how it works, and why it matters.

Create

Create a checklist that demonstrates Data Observability in a real-world best practices scenario. Walk through your design decisions.

Show solution
A checklist for Data Observability should include: 1. The core components of data observability 2. How they interact 3. Expected outcomes or outputs
Difficulty: Beginner-friendly — 2/5

Pipeline Cost Optimization is a concept in best practices. In simple terms, Pipeline Cost Optimization covers best practices in Data Engineering. This data engineering concept addresses key topics in the best practices in data engineering domain. Also known as: cost optimizat

Analogy
Think of Pipeline Cost Optimization like a maintenance checklist for a power plant — it helps you handle best practices tasks more effectively.
Example
Consider a scenario where Pipeline Cost Optimization applies: Pipeline Cost Optimization covers best practices in Data Engineering. This data engineering concept addresses key topics in the best practices in data engineering domain. Also known as: cost optimizat...
Find Gaps
What are the key components or steps involved in Pipeline Cost Optimization?
Can you explain Pipeline Cost Optimization without using jargon?
What happens if Pipeline Cost Optimization is not applied correctly?
How does Pipeline Cost Optimization relate to other concepts in best practices?
Teach Back

Explain Pipeline Cost Optimization as if teaching a colleague who is new to best practices. Cover: what it is, how it works, and why it matters.

Create

Create a checklist that demonstrates Pipeline Cost Optimization in a real-world best practices scenario. Walk through your design decisions.

Show solution
A checklist for Pipeline Cost Optimization should include: 1. The core components of pipeline cost optimization 2. How they interact 3. Expected outcomes or outputs
Difficulty: Intermediate — 3/5

Feynman Synthesis — Prove You Understand

1. The One-Pager

Explain this lesson's core idea to a smart 15-year-old. No jargon allowed.

2. The Gap Map

List 3 things you are still unsure about. Be specific.

Knowledge Check

Test your understanding of this lesson.

Flashcards

Space = flip · 1-4 = grade · Swipe on mobile

Related Research

Related Knowledge

Stay Updated

Get the latest research summaries delivered to your inbox.