airflow-provider-great-expectations
airflow-provider-great-expectations copied to clipboard
Add operator extra link for Data Docs in the `GreatExpectationsOperator`
In Airflow, there is a feature which allows for external links to be present as buttons on the Task Instance modal in the Airflow UI called an operator extra link. This feature is really useful to directly navigate from the Airflow UI to an external site which may be for monitoring a third-party execution that Airflow just triggered, handy documentation, etc.
IMO linking to Data Docs directly from a GreatExpectationsOperator
task would be really beneficial to users and increase the holistic visibility that's available at their fingertips.
Hi @josh-fell - this is a really cool idea! The location for the Data Docs sites would be available through the Data Context, by using DataContext.get_docs_sites_urls()
, which would be available via the main Operator. What would be the best way of passing this information out of the Operator and into a Plugin for these purposes?
The easiest, and the most widely-used, way to get that data into an operator link is via XCom
. If you can push a URL to XCom
or whatever values would be needed to build the URL string, you can have the get_link()
method that would be overwritten to return the URL.
For some examples, check out Azure Data Factory and dbt Cloud providers. Then in the GreatExpectationOperator
you can add the link as an attribute. Something like:
class GreatExpectationsOperator:
...
operator_extra_links = (DataDocsLink(),)
...
def __init__(...):
Completed in 0.2.0