SuperAPI AI 工具集

creating-openlineage-extractors

数据与分析

查看项目

更新于 10-16 06:50

技能介绍

用途:为 Airflow 中未内置 OpenLineage 支持的算子捕获血缘(lineage),尤其适用于第三方算子以及需要列级血缘或复杂提取逻辑的场景。

方案选择:自维护算子推荐使用 OpenLineage Methods;无法修改的第三方算子使用 Custom Extractor;需要列级血缘或复杂逻辑时用前两者;仅需简单表级血缘可用 Inlets/Outlets(最简单、优先级最低)。

方案一 OpenLineage Methods:在自定义算子上定义 get_openlineage_facets_on_start 返回 OperatorLineage(inputs、outputs 的 Dataset);在 get_openlineage_facets_on_complete 中可补充 facets,如 outputStatistics 的 rowCount。

方案二 Custom Extractors:继承 BaseExtractor,实现 get_operator_classnames 返回算子类名列表,在 _execute_extraction 中读取算子属性并返回 OperatorLineage;可重写 extract_on_complete。

注册方式:配置文件 [openlineage] 下 extractors = 类路径,多个用分号分隔;或用环境变量 AIRFLOW__OPENLINEAGE__EXTRACTORS='...;...'。

限制:资料未提供版本要求、兼容性、安装步骤与验证方式,暂未提供。