tracing-upstream-lineage

Отслеживает восходящую линию данных для определения источников, DAG и зависимостей, питающих таблицу или столбец. Поддерживает трассировку трех типов целей: таблиц, столбцов и DAG; использует исходный код DAG Airflow и проверку задач для поиска производящих конвейеров. Обрабатывает SQL-источники (предложения FROM), внешние системы (S3, Postgres, Salesforce, HTTP API) и файловые источники; рекурсивно отслеживает восходящие цепочки. Включает трассировку на уровне столбцов через прямые сопоставления, преобразования и агрегации в коде DAG...

npx skills add https://github.com/astronomer/agents --skill tracing-upstream-lineage

Upstream Lineage: Sources

Trace the origins of data - answer "Where does this data come from?"

Lineage Investigation

Step 1: Identify the Target Type

Determine what we're tracing:

  • Table: Trace what populates this table
  • Column: Trace where this specific column comes from
  • DAG: Trace what data sources this DAG reads from

Step 2: Find the Producing DAG

Tables are typically populated by Airflow DAGs. Find the connection:

  1. Search DAGs by name: Use af dags list and look for DAG names matching the table name

    • load_customers -> customers table
    • etl_daily_orders -> orders table
  2. Explore DAG source code: Use af dags source <dag_id> to read the DAG definition

    • Look for INSERT, MERGE, CREATE TABLE statements
    • Find the target table in the code
  3. Check DAG tasks: Use af tasks list <dag_id> to see what operations the DAG performs

On Astro

If you're running on Astro, the Lineage tab in the Astro UI provides visual lineage exploration across DAGs and datasets. Use it to quickly trace upstream dependencies without manually searching DAG source code.

On OSS Airflow

Use DAG source code and task logs to trace lineage (no built-in cross-DAG UI).

Step 3: Trace Data Sources

From the DAG code, identify source tables and systems:

SQL Sources (look for FROM clauses):

# In DAG code:
SELECT * FROM source_schema.source_table  # <- This is an upstream source

External Sources (look for connection references):

  • S3Operator -> S3 bucket source
  • PostgresOperator -> Postgres database source
  • SalesforceOperator -> Salesforce API source
  • HttpOperator -> REST API source

File Sources:

  • CSV/Parquet files in object storage
  • SFTP drops
  • Local file paths

Step 4: Build the Lineage Chain

Recursively trace each source:

TARGET: analytics.orders_daily
    ^
    +-- DAG: etl_daily_orders
            ^
            +-- SOURCE: raw.orders (table)
            |       ^
            |       +-- DAG: ingest_orders
            |               ^
            |               +-- SOURCE: Salesforce API (external)
            |
            +-- SOURCE: dim.customers (table)
                    ^
                    +-- DAG: load_customers
                            ^
                            +-- SOURCE: PostgreSQL (external DB)

Step 5: Check Source Health

For each upstream source:

  • Tables: Check freshness with the checking-freshness skill
  • DAGs: Check recent run status with af dags stats
  • External systems: Note connection info from DAG code

Lineage for Columns

When tracing a specific column:

  1. Find the column in the target table schema
  2. Search DAG source code for references to that column name
  3. Trace through transformations:
    • Direct mappings: source.col AS target_col
    • Transformations: COALESCE(a.col, b.col) AS target_col
    • Aggregations: SUM(detail.amount) AS total_amount

Output: Lineage Report

Summary

One-line answer: "This table is populated by DAG X from sources Y and Z"

Lineage Diagram

[Salesforce] --> [raw.opportunities] --> [stg.opportunities] --> [fct.sales]
                        |                        |
                   DAG: ingest_sfdc         DAG: transform_sales

Source Details

SourceTypeConnectionFreshnessOwner
raw.ordersTableInternal2h agodata-team
SalesforceAPIsalesforce_connReal-timesales-ops

Transformation Chain

Describe how data flows and transforms:

  1. Raw data lands in raw.orders via Salesforce API sync
  2. DAG transform_orders cleans and dedupes into stg.orders
  3. DAG build_order_facts joins with dimensions into fct.orders

Data Quality Implications

  • Single points of failure?
  • Stale upstream sources?
  • Complex transformation chains that could break?

Related Skills

  • Check source freshness: checking-freshness skill
  • Debug source DAG: debugging-dags skill
  • Trace downstream impacts: tracing-downstream-lineage skill
  • Add manual lineage annotations: annotating-task-lineage skill
  • Build custom lineage extractors: creating-openlineage-extractors skill

Больше skills от astronomer

airflow-state-store
astronomer
Persists task and asset state across retries and DAG runs using Airflow 3.3's AIP-103 key/value stores (`task_state_store`, `asset_state_store`) and the…
creating-openlineage-extractors
astronomer
Пользовательские экстракторы OpenLineage для неподдерживаемых операторов Airflow и сложных сценариев происхождения данных. Два подхода: добавление методов OpenLineage непосредственно в операторы, которыми вы владеете (рекомендуется), или создание пользовательских экстракторов для сторонних операторов, которые вы не можете изменить. Экстракторы перехватывают выполнение оператора в трех точках: перед выполнением для статического происхождения, после успешного выполнения для определения выходных данных во время выполнения и опционально после сбоя для частичного происхождения. Регистрируйте экстракторы через airflow.cfg или переменные окружения...
debugging-dags
astronomer
Систематический анализ первопричин и устранение неисправностей для упавших DAG-графов Airflow с использованием структурированных рабочих процессов расследования. Проводит через четырехэтапный процесс диагностики: выявление сбоя, извлечение деталей ошибки, сбор контекстной информации и предоставление практических шагов по исправлению. Классифицирует сбои на четыре типа (данные, код, инфраструктура, зависимости) для фокусировки расследования и предложения соответствующих исправлений. Предоставляет готовые к использованию команды CLI для извлечения журналов, сравнения запусков, очистки задач и DAG...
delegating-to-otto
astronomer
Drives Astronomer's Otto agent (`astro otto`) as a delegated sub-agent for Airflow, dbt, and data-engineering work. Use when the user explicitly asks to "use…
deploying-airflow
astronomer
Развертывание DAG-файлов и проектов Airflow. Используйте, когда пользователь хочет развернуть код, отправить DAG-файлы, настроить CI/CD, выполнить развертывание в рабочей среде или спрашивает о стратегиях развертывания…
deploying-go-sdk-bundles
astronomer
Собирает, упаковывает и развёртывает скомпилированные пакеты Airflow Go SDK, чтобы ExecutableCoordinator мог их запускать. Используйте, когда пользователь хочет скомпилировать пакет задач Go, спрашивает…
testing-dags
astronomer
Итеративные циклы тестирования, отладки и исправления для DAG-файлов Airflow с комплексной диагностикой сбоев. Начните с af runs trigger-wait <dag_id> для запуска DAG и ожидания завершения; предварительные проверки не требуются. При сбое используйте af runs diagnose для получения сводки по сбоям и af tasks logs для просмотра деталей ошибок из конкретных задач. Поддерживает пользовательскую конфигурацию, тайм-ауты и повторные попытки; обрабатывает сценарии успеха, сбоя и тайм-аута с четкой интерпретацией результатов. Доступна быстрая проверка...
tracing-downstream-lineage
astronomer
Отслеживание нисходящей линии данных для оценки влияния изменений перед модификацией таблиц или DAG. Определяет прямых потребителей целевой таблицы или DAG через поиск исходного кода, зависимости представлений и подключения BI-инструментов. Строит полное дерево зависимостей, отображающее все нисходящие воздействия — от таблиц до дашбордов и ML-моделей. Классифицирует зависимости по критичности (критическая, высокая, средняя, низкая) для приоритизации коммуникации с заинтересованными сторонами и тестирования. Формирует отчет о влиянии с оценкой рисков, затронутыми...