SQLIntervalCheckOperator

Apache Airflow Certified

Checks that the values of metrics given as SQL expressions are within a certain tolerance of the ones from days_back before.

View on GitHub

Last Updated: May. 25, 2021

Access Instructions

Install the Apache Airflow provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.

Parameters

tableRequiredstrthe table name
conn_idstrthe connection ID used to connect to the database.
databaseOptional[str]name of database which will overwrite the defined one in connection
days_backOptional[int]number of days between ds and the ds we want to check against. Defaults to 7 days
date_filter_columnOptional[str]The column name for the dates to filter on. Defaults to ‘ds’
ratio_formulastrwhich formula to use to compute the ratio between the two metrics. Assuming cur is the metric of today and ref is the metric to today - days_back. max_over_min: computes max(cur, ref) / min(cur, ref) relative_diff: computes abs(cur-ref) / ref Default: ‘max_over_min’
ignore_zeroboolwhether we should ignore zero metrics
metrics_thresholdsRequireddicta dictionary of ratios indexed by metrics

Documentation

Checks that the values of metrics given as SQL expressions are within a certain tolerance of the ones from days_back before.

Was this page helpful?