Skip to content

dbt: propagate root parent through dbt-run wrapper to child events#4522

Merged
mobuchowski merged 2 commits into
OpenLineage:mainfrom
mobuchowski:dbt-legacy-root-parent-propagation
May 8, 2026
Merged

dbt: propagate root parent through dbt-run wrapper to child events#4522
mobuchowski merged 2 commits into
OpenLineage:mainfrom
mobuchowski:dbt-legacy-root-parent-propagation

Conversation

@mobuchowski
Copy link
Copy Markdown
Member

@mobuchowski mobuchowski commented May 7, 2026

The legacy consume_local_artifacts path constructs dbt_run_metadata without root_parent_* fields, so every per-node event uses self._dbt_run_metadata.to_openlineage() and ends up with root=None in its parent facet.

Checklist

  • AI was used in creating this PR

The legacy `consume_local_artifacts` path constructs `dbt_run_metadata`
without `root_parent_*` fields, so every per-node event uses
`self._dbt_run_metadata.to_openlineage()` and ends up with `root=None` in
its parent facet. Backends lose the orchestrator → dbt-run → node stitching
and the dbt-run wrapper appears as a free-floating root sibling of Airflow
instead of its child.

Carry the root parent through:
- when there's an external orchestrator (`OPENLINEAGE_PARENT_ID` set),
  inherit its root (or its own identity if no `OPENLINEAGE_ROOT_PARENT_ID`)
- when there's no orchestrator, the dbt-run wrapper itself is the root

Mirrors the structured-logs path's `_setup_dbt_run_metadata`, which already
extracts root from the start event's parent facet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
@mobuchowski mobuchowski requested a review from a team as a code owner May 7, 2026 12:22
@boring-cyborg boring-cyborg Bot added area:integration/dbt openlineage-dbt area:tests Testing code language:python Uses Python programming language labels May 7, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 7, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.06%. Comparing base (29dda14) to head (c5d251d).
⚠️ Report is 9 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4522   +/-   ##
=======================================
  Coverage   73.06%   73.06%           
=======================================
  Files          21       21           
  Lines        2291     2291           
=======================================
  Hits         1674     1674           
  Misses        617      617           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread integration/dbt/src/openlineage/dbt/__init__.py
Comment thread integration/dbt/tests/test_main.py
Comment thread integration/dbt/tests/test_main.py
…rtifacts

When propagating root parent metadata to per-node events, use root values
only when all three fields (run_id, job_name, job_namespace) are present.
Previously, field-by-field or fallbacks could mix a root run_id with a
parent job_name, producing an incoherent reference.

Add tests for explicit root distinct from parent, and for partial/malformed
OPENLINEAGE_ROOT_PARENT_ID falling back entirely to immediate parent values.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
@mobuchowski mobuchowski merged commit ac292ed into OpenLineage:main May 8, 2026
52 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:integration/dbt openlineage-dbt area:tests Testing code language:python Uses Python programming language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants