Requirements: Python 3.10+, Great Expectations 1.7.0+, Apache Airflow 2.1+.
Install with:
Choose the right operator
When deciding which operator fits your use case, consider:- Where is your data? In memory as a DataFrame, or in an external data source?
- Do you need to trigger actions? Such as sending notifications or updating external systems based on validation results.
- What Data Context do you need? Ephemeral for stateless validations, or persistent to track results over time.
GXValidateDataFrameOperator
Use this operator when your data is already in memory as a Pandas or Spark DataFrame. This is the simplest option, you only need a DataFrame and your expectations.
GXValidateDataFrameOperator example
GXValidateDataFrameOperator example
configure_expectations signatureThe
configure_expectations callable receives the DataFrame as its first argument and must return an Expectation or ExpectationSuite.GXValidateBatchOperator
Use this operator when your data isn’t in memory. You configure GX to connect directly to your data source by defining a BatchDefinition. This approach works with databases, warehouses, and file systems.
GXValidateBatchOperator example (SQL)
GXValidateBatchOperator example (SQL)
GXValidateBatchOperator example (file-based)
GXValidateBatchOperator example (file-based)
For file-based data (CSV, Parquet), use
add_pandas_filesystem instead:configure_expectations signatureFor
GXValidateBatchOperator, the configure_expectations callable receives the GX context as its first argument (not the DataFrame). Use context.suites.add_or_update() to register your suite.GXValidateCheckpointOperator
Use this operator when you need the full power of GX Core, including the ability to trigger actions based on validation results. This requires the most configuration. You define a Checkpoint with a BatchDefinition, ExpectationSuite, and ValidationDefinition.
GXValidateCheckpointOperator example
GXValidateCheckpointOperator example