Inferensys

Glossary

Great Expectations

Great Expectations is an open-source Python library for defining, documenting, and validating data quality expectations, enabling test-driven data pipelines.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
AUTOMATED DATA TESTING

What is Great Expectations?

An open-source Python framework for defining, documenting, and validating data quality expectations as code.

Great Expectations is an open-source Python library that enables test-driven data pipelines by allowing data engineers to define, document, and validate data quality rules—called expectations—as version-controlled code. It provides a declarative framework to assert that data meets specific conditions for schema, freshness, distribution, and custom business logic, transforming ad-hoc data validation into a reproducible engineering practice. The library generates data quality documentation automatically and integrates with orchestration tools to act as a pipeline-gated test, blocking bad data from propagating downstream.

At its core, the tool operates by profiling data to suggest expectations and then validating batches of data against a stored Expectation Suite. Results are captured in Data Docs, which are human-readable, static HTML reports detailing validation outcomes. This approach establishes a shared language for data quality between engineering and business teams, providing algorithmic trust in data assets. By codifying expectations, it shifts data validation from a manual, reactive process to an automated, proactive component of the data observability and quality posture.

GREAT EXPECTATIONS

Core Components and Features

Great Expectations is a Python library for defining, documenting, and validating data quality. Its architecture is built around a few core abstractions that enable test-driven data pipelines.

01

Expectations

The fundamental building block of a Great Expectations suite. An Expectation is a declarative, human-readable statement about your data that can be validated. It defines what "good data" looks like, not how to check it.

  • Examples: expect_column_values_to_be_unique, expect_table_row_count_to_be_between, expect_column_values_to_match_regex.
  • Expectations are deterministic and produce a clear pass/fail result.
  • They can be created by profiling data, written manually, or suggested by the library.
02

Expectation Suites

A collection of Expectations grouped together to define the complete quality contract for a specific data asset (e.g., a database table or a file).

  • An Expectation Suite acts as a single, versionable specification for data quality.
  • It is typically stored as a JSON file, making it portable and easy to version control.
  • Suites are executed as a unit by Checkpoints to validate a batch of data.
03

Data Context

The primary entry point and configuration manager for a Great Expectations project. The Data Context holds all configuration, connects to data sources, and knows where Expectation Suites, Checkpoints, and validation results are stored.

  • It can be configured via a great_expectations.yml file.
  • It manages connections to Datasources (e.g., PostgreSQL, S3, Spark).
  • It provides the runtime environment for all validation operations.
04

Checkpoints

A configured operation that orchestrates the validation of a data asset. A Checkpoint bundles an Expectation Suite with a specific data batch and defines actions to take based on the validation result.

  • Core Function: Run a suite against a dataset, store the results, and optionally trigger notifications (e.g., Slack, email) or block a pipeline.
  • They enable pipeline-gated testing by integrating validation into workflow tools like Airflow, Prefect, or Dagster.
  • Checkpoints can be run via CLI, Python API, or triggered by external schedulers.
05

Data Docs

Automatically generated, human-readable documentation for your data quality. Data Docs render Expectation Suites and validation results into HTML reports, providing a clear audit trail.

  • They serve as a single source of truth for data quality, accessible to engineers and stakeholders.
  • Docs can be hosted locally or on cloud storage (e.g., S3, GCS) for easy sharing.
  • Each validation run updates the docs, creating a historical record of data health.
06

Validation Results

The structured output produced when a Checkpoint runs an Expectation Suite. A Validation Result contains the pass/fail status of each expectation, summary statistics, and a copy of the batch's metadata.

  • Results are stored in a Metrics Store (configurable backend) for historical analysis.
  • The structured format enables integration with monitoring dashboards and alerting systems.
  • Results power Data Docs, providing the evidence for the documented quality state.
AUTOMATED DATA TESTING

How Great Expectations Works

Great Expectations is an open-source Python library for defining, documenting, and validating data quality expectations, enabling test-driven data pipelines and data quality profiling.

Great Expectations is a declarative testing framework where data quality rules, called Expectations, are defined in code. These Expectations form an Expectation Suite that documents the expected schema, types, statistical properties, and business rules for a dataset. The framework's core engine validates data against this suite, producing a structured Validation Result that details which expectations passed or failed, enabling automated quality gates in pipelines.

Operationally, validation is executed via a Checkpoint, which runs a suite against a specific data batch (e.g., a new file or table partition). Results are stored in a Data Docs site, providing human-readable documentation of data health. This creates a test-driven development cycle for data, where expectations are defined upfront and pipelines are gated by validation, preventing bad data from propagating downstream to models or dashboards.

GREAT EXPECTATIONS

Common Use Cases and Expectations

Great Expectations is an open-source Python library that enables data teams to define, document, and validate data quality expectations, creating test-driven data pipelines. Below are its primary applications and core components.

01

Data Pipeline Validation

Great Expectations is used to programmatically validate data as it moves through pipelines. Engineers embed Expectation Suites—collections of rules—at key stages (e.g., after ingestion or transformation). A Checkpoint executes these suites, comparing incoming data against defined expectations like schema conformity, value ranges, and row counts. Failures can trigger alerts or halt pipelines, preventing corrupt data from propagating to downstream models and dashboards.

02

Data Profiling and Documentation

The library automates data profiling to discover statistical properties and infer potential expectations. It generates Data Docs, which are human-readable, HTML-based documentation of your datasets and the expectations defined on them. This serves as a living data contract, clearly communicating the expected shape, content, and quality of data assets to all consumers, including data scientists and analysts.

03

Test-Driven Data Development

Applying Test-Driven Development (TDD) principles to data engineering, teams write expectations before building or modifying pipelines. This ensures the pipeline logic is designed to meet explicit quality requirements. Expectations act as unit tests for data, validating individual transformations, and integration tests, ensuring correct data flow between components. This methodology shifts quality left, catching issues early in the development cycle.

04

Production Monitoring & Alerting

In production, Great Expectations functions as a data quality monitoring system. Scheduled checkpoints run validation suites on fresh data, enabling continuous testing. Results are logged and can be integrated with monitoring tools like Datadog or PagerDuty. Teams set data quality gates (e.g., 95% of expectations must pass) and receive alerts for anomalies like sudden volume drops, schema drift, or unexpected null values, facilitating rapid data incident management.

05

Core Component: Expectation Suite

An Expectation Suite is a collection of executable assertions about a dataset. Each expectation is a declarative statement, such as expect_column_values_to_be_between. Suites are defined in JSON and can be created manually, inferred via profiling, or generated from data contracts. They encapsulate both simple schema checks and complex business rule validation, serving as the single source of truth for a dataset's expected behavior.

06

Core Component: Checkpoint & Data Docs

A Checkpoint is the operational configuration that binds an Expectation Suite to a specific data asset (e.g., a database table) and defines validation actions. It is the executable unit of validation. Data Docs are automatically generated, static HTML sites that render Expectation Suites and validation results. They provide a centralized, shareable view of data health, expectations, and lineage, turning validation from a log file into an interactive data observability portal.

FEATURE COMPARISON

Great Expectations vs. Other Data Testing Tools

A technical comparison of open-source Python-based data quality frameworks, focusing on core architectural features for automated data testing.

Feature / CapabilityGreat Expectationsdbt TestsSoda Core

Core Language & Integration

Python-native library; integrates via code or CLI

SQL/YAML within dbt project; tight dbt integration

YAML/CLI; connectors for data sources

Validation Engine

Proprietary Pandas/Spark/SQL backend

SQL-based execution via data warehouse

SQL-based execution via data warehouse

Expectation/Test Definition

Python API or CLI for Expectation Suites

Declarative YAML or Jinja-SQL in .yml files

Declarative YAML configuration (checks)

Data Profiling & Suggestions

Automated profiling to suggest Expectations

Manual definition only; no automated profiling

Basic automated profiling for schema/metrics

Checkpoints & Orchestration

Checkpoints for batch validation; actions on results

Test execution tied to dbt run; no standalone orchestration

Scans triggered via CLI/SDK; limited native orchestration

Result Data Docs & UI

Automatically generated HTML Data Docs

Console output & run artifacts; limited static docs

Soda Cloud UI or local results; basic HTML reports

Pipeline Gating

Yes; programmatic failure raises exceptions

Yes; --fail-fast option stops run on test failure

Yes; non-zero exit code on scan failure

Community & Extensibility

Large OSS community; custom Expectation API

Massive dbt ecosystem; custom macros for complex tests

Growing community; custom checks via SQL/metrics

GREAT EXPECTATIONS

Frequently Asked Questions

Common technical questions about the Great Expectations open-source library for defining, documenting, and validating data quality expectations.

Great Expectations is an open-source Python library for defining, documenting, and validating data quality expectations, enabling test-driven data pipelines. It works by allowing data engineers to create Expectation Suites—collections of declarative rules about data properties—which are then executed by a Validation Engine against datasets. The engine produces a structured Validation Result documenting which expectations passed or failed, enabling automated quality gates and data profiling.

Core workflow:

  1. Connect to Data: Use a Datasource (e.g., Pandas, Spark, SQL) to access data.
  2. Create Expectations: Profile data or manually define rules (e.g., expect_column_values_to_be_unique, expect_table_row_count_to_be_between).
  3. Validate: Run a Checkpoint, which executes the Expectation Suite against a dataset.
  4. Review & Act: Analyze validation results, generate Data Docs (HTML documentation), and trigger alerts or block pipelines on failure.
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.