Verified data quality,
with a report for every validation.
Great Expectations declares data quality rules as expectations and checks them against SQL databases, files, and pandas and Spark DataFrames. Every validation returns a result and human-readable documentation. Follow a validation, from the connection to the data to the Data Docs.
Great Expectations (GX) is a Python data validation library: rules are written as expectations, and every validation returns a result and human-readable documentation.
Expectations are grouped into an Expectation Suite, and the Checkpoint is the primary means of validating data in production.
Rules
One expectation per rule
Each rule is an Expectation, a verifiable assertion about the data, and Expectations are grouped into an Expectation Suite.
Validation
From the batch of data to the result
The Validation Definition links a batch of data to a suite, the Checkpoint runs it, and GX returns a Validation Result.
Report
Readable documentation
Data Docs translate expectations and results into human-readable documentation, as static web pages.
On this page
- See a validation happen
- Architecture
- From data to batch
- What a validation produces
- Why Great Expectations
- In the TDP editions
See a validation happen
Press Play or step through one at a time. Underlined names lead to the Glossary.
1 GX knows the data
The Data Source is the GX representation of a data store: a SQL database, files in a folder hierarchy, or pandas and Spark DataFrames. Within it, the Data Asset groups the records that will be validated.
In the Glossary: Data Source · Data Asset
- GX knows the data. The Data Source is the GX representation of a data store: a SQL database, files in a folder hierarchy, or pandas and Spark DataFrames. Within it, the Data Asset groups the records that will be validated.
- Records become batches. The Batch Definition tells GX how to organize the records in the Data Asset. Each batch, a Batch, is a selection of records from the Data Asset.
- Rules are expectations. An Expectation is a verifiable assertion about data. Expectations are grouped into an Expectation Suite, which describes the ideal state of a set of data.
- The Validation Definition joins data and rules. The Validation Definition explicitly associates the Batch Definition with the Expectation Suite. It can be run with the predefined defaults or with parameters provided at runtime.
- The Checkpoint runs the validation. The Checkpoint runs one or more Validation Definitions. It is the primary means of validating data in a production deployment of GX.
- The validation result. After validating the data against the suite, GX returns a Validation Result.
- Actions react to the result. Based on the Validation Results, the Checkpoint runs a set of Actions, such as the SlackNotificationAction, which sends a Slack message when an Expectation fails, and the UpdateDataDocsAction, which updates the Data Docs site with the results.
Architecture
Data and expectations meet in the Validation Definition. The Checkpoint runs it and delivers the result.
What the figure shows:
- The Data Source: provides access to the data.
- The Data Asset: groups the records.
- The Batch Definition: organizes the records into batches.
- The Expectation Suite: groups the Expectations.
- The Validation Definition: associates the Batch Definition with the Expectation Suite.
- The Checkpoint: runs the Validation Definition.
- The Validation Result: is the outcome of the validation, returned by GX.
- The Actions: those of the Checkpoint react to the result.
- The Data Docs: readable documentation, updated by the Checkpoint Actions.
The Data Context is the Python object that provides access to the configurations, metadata, and actions of this workflow.
From data to batch
A data store, from the broadest level to the most concrete: each level contains the next.
Level 1 of 3
Data Source
The GX representation of a data store. The data in a Data Source is organized into batches for validation.
- SQLData in SQL databases.
- FilesystemData stored as files in a folder hierarchy.
- DataframesData in pandas or Spark DataFrames.
- Data Source. The GX representation of a data store. The data in a Data Source is organized into batches for validation.
- SQL. Data in SQL databases.
- Filesystem. Data stored as files in a folder hierarchy.
- Dataframes. Data in pandas or Spark DataFrames.
- Data Asset. A collection of records within the Data Source, usually named after the underlying data system.
- Batch Definition. Tells GX how to organize the records in the Data Asset. Each batch, a Batch, is a selection of records from the Data Asset.
- Validation Definition. Associates the Batch Definition with an Expectation Suite.
What a validation produces
The result, the documentation, and the reactions: three outputs of every Checkpoint run.
Result
Validation Result
Returned by GX after the data is validated against an Expectation or an Expectation Suite. It is what the Actions and the Data Docs receive.
Documentation
Data Docs
Human-readable documentation generated from the Expectations, the Validation Results, and other metadata, as static web pages. The UpdateDataDocsAction, in a Checkpoint, updates the site on every run.
Reaction
Actions
In a Checkpoint, Actions such as the SlackNotificationAction send notifications when an Expectation fails, and custom Actions are possible. The list of Actions runs once for each Validation Definition in the Checkpoint, and notify_on controls when a notification is triggered.
Why Great Expectations
Declarative rules
Expectations
Each rule is a verifiable assertion about the data, and the rules are grouped into suites that describe the ideal state of a set of data.
Multiple sources
SQL, files, and DataFrames
SQL databases, files in a folder hierarchy, and pandas and Spark DataFrames are organized into batches for validation.
Readable reports
Data Docs
Human-readable documentation, as static web pages, compiled automatically from the data tests.
Production
Checkpoint
The primary means of validating data in a production deployment of GX, with one or more Validation Definitions.
Reaction to the result
Actions
Notifications, such as a Slack message when an Expectation fails, Data Docs updates, and custom Actions.
At runtime
Runtime parameters
A Validation Definition runs with the predefined defaults or with parameters provided at runtime.
In the TDP editions
| Edition | Version | Documentation |
|---|---|---|
| TDP Datacenter | 1.3.5 | TDP Datacenter components |
| TDP Kubernetes | 1.23.0 |
In TDP Datacenter
In TDP Datacenter, Great Expectations is the GREAT_EXPECTATIONS service, installed and managed by Ambari as a Python library.
GREAT_EXPECTATIONS_CLIENT (client, one or more). Component category.
The spark3-env configuration of Spark uses the Great Expectations python3 and ipython3 in PYSPARK_PYTHON and PYSPARK_DRIVER_PYTHON when GX is installed on the machine.
The airflow-provider-great-expectations provider already comes installed in Airflow.
The great-expectations library is available in the JupyterLab notebooks.
In TDP Kubernetes
In TDP Kubernetes, Great Expectations is a Python library installed in the Spark and Jupyter images.
The Spark image and the Jupyter image include Great Expectations, along with Polars, DuckDB, and PyIceberg. The versions are in TDP Kubernetes Components.
The library is available in the JupyterLab notebooks, installed by the Jupyter image.
The library is available in Spark applications, installed by the Spark image.
In both editions, the flow of a validation is the one in Figure 1. What changes is where the library is installed: on the cluster machines in TDP Datacenter, and in the Spark and Jupyter images in TDP Kubernetes.
Next steps
TDP Datacenter
TDP Datacenter Architecture
The services of the cluster managed by Ambari and how they relate.
TDP Kubernetes
TDP Kubernetes Components
The versions of the components and of the libraries in the images.