An Apache Airflow provider for Great Expectations
Project description
Apache Airflow Provider for Great Expectations
This is an experimental library as of March 2021! The Great Expectations core team maintains this provider in an experimental state and does not guarantee ongoing support yet.
An Airflow operator for Great Expectations, a Python library for testing and validating data.
Notes on compatibility
- This operator has been updated to use Great Expectations Checkpoints instead of the former ValidationOperators. Therefore, it requires Great Expectations >=v0.13.9, which is pinned in the requirements.txt starting with release 0.0.5.
- Great Expectations version 0.13.8 unfortunately contained a bug that would make this operator not work.
- Great Expectations version 0.13.7 and below will work with version 0.0.4 of this operator and below.
This package has been most recently tested with Airflow 2.0 and Great Expectations v0.13.7.
Installation
Pre-requisites: An environment running great-expectations
and apache-airflow
- these are requirements of this package that will be installed as dependencies.
pip install airflow-provider-great-expectations
In order to run the BigQueryOperator
, you will also need to install the relevant dependencies: pybigquery
and apache-airflow-providers-google
Depending on your use-case, you might need to add ENV AIRFLOW__CORE__ENABLE_XCOM_PICKLING=true
to your Dockerfile to enable XCOM to pass data between tasks.
Modules
Great Expectations Operator: A base operator for Great Expectations. Import into your DAG via:
from great_expectations_provider.operators.great_expectations import GreatExpectationsOperator
Great Expectations BigQuery Operator: An operator for Great Expectations that provides some pre-set parameters for a BigQuery Datasource and Expectation, Validation, and Data Docs stores in Google Cloud Storage. The operator can also be configured to send email on validation failure. See the docstrings in the class for more configuration options. Import into your DAG via:
from great_expectations_provider.operators.great_expectations_bigquery import GreatExpectationsBigQueryOperator
Examples
See the example_dags directory for an example DAG with some sample tasks that demonstrate operator functionality. The example DAG file contains a comment with instructions on how to run the examples.
Note that to make these operators work, you will need to change the value of enable_xcom_pickling
to true
in your airflow.cfg.
These examples can be tested in one of two ways:
With the open-source Astro CLI:
- Initialize a project with the Astro CLI
- Copy the example DAG into the
dags/
folder of your astro project - Add the following env var to your
Dockerfile
to enable xcom pickling:ENV AIRFLOW__CORE__ENABLE_XCOM_PICKLING=True
- Copy the directories in the
include
folder of this repository into theinclude
directory of your Astro project - Add
airflow-provider-great-expectations
to yourrequirements.txt
- Run
astro dev start
to view the DAG on a local Airflow instance (you will need Docker running)
With a vanilla Airflow installation:
- Add the example DAG to your
dags/
folder - Make the
great_expectations
anddata
directories ininclude/
available in your environment. - Change the
data_file
andge_root_dir
paths in your DAG file to point to the appropriate places. - Change the paths in
great-expectations/checkpoints/*.yml
to point to the absolute path of your data files.
**This operator is in early stages of development! Feel free to submit issues, PRs, or join the #integration-airflow channel in the Great Expectations Slack for feedback. Thanks to Pete DeJoy and the Astronomer.io team for the support.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for airflow-provider-great-expectations-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 821526a3762065a17a2dda2393a6b9b33f7d23886d04bb060795026a656ba780 |
|
MD5 | 2471f854293df50ec59ae7227301406d |
|
BLAKE2b-256 | 80385e899016e321dede66b7b6b5179fdf0189702f1337bdba73e33436afdf99 |
Hashes for airflow_provider_great_expectations-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 795f4a44b92cb344f1198ffe1ef47f2fb2fcfc2c2e5ccd50e8d55cba42b00de9 |
|
MD5 | 1b73cd974ba40e6ca7262ebad522ad5b |
|
BLAKE2b-256 | 6516e764e1950b27680cb6721db18f2c04ff978cb7a0d2089016d140132a1142 |