Skip to content

[v3-1-test] Fix log task instance join (#59973)#60222

Merged
jscheffl merged 5 commits intoapache:v3-1-testfrom
Subham-KRLX:fix-backport-v3-1-test
Jan 7, 2026
Merged

[v3-1-test] Fix log task instance join (#59973)#60222
jscheffl merged 5 commits intoapache:v3-1-testfrom
Subham-KRLX:fix-backport-v3-1-test

Conversation

@Subham-KRLX
Copy link
Copy Markdown
Contributor

@Subham-KRLX Subham-KRLX commented Jan 7, 2026

Manual backport of logic from #59973 to v3-1-test.

The automated backport (#60208) failed because v3-1-test doesn't support the SQLAlchemy 2.0 Mapped type hints used in main.

This PR:

  • Applies the corrected join logic (dag_id, task_id, run_id, map_index).
  • Removes incompatible Mapped annotations in airflow/models/log.py to match the environment.
  • Flattens primaryjoin string for Ruff compatibility.

related: #59973
closes: #60208

Subham-KRLX and others added 2 commits January 7, 2026 11:06
* Fix incorrect Log and TaskInstance join query

* Fix log task instance join foreign keys and remove stray newsfragment

* Remove unused task variable assignments in test_log_task_instance_join_correctness

* Fix CI failures and address reviewer comments: revert unrelated doc changes, clean up tests, add Mapped type hints to Log relationships, and run ruff formatting

* Restore newsfragment and fix missing import in log.py

* Fix reviewer feedback: add license, move imports, and fix newsfragments

* Fix ruff static check failure in log.py

* Flatten primaryjoin definition to fix formatting

* Fix newsfragments per review: restore 58337 and remove 59965

* Remove unused import in log.py

---------
(cherry picked from commit 91af86e)

Co-authored-by: Subham <subhamsangwan26@gmail.com>
Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
@Subham-KRLX Subham-KRLX marked this pull request as ready for review January 7, 2026 15:44
@potiuk potiuk changed the title Fix backport v3 1 test [v3-1-test] Fix log task instance join (#59973) Jan 7, 2026
@Subham-KRLX
Copy link
Copy Markdown
Contributor Author

I have pushed a fix for the static check failure (unused import in log.py).
The import from airflow.models.dag import DagModel was no longer needed after removing the Mapped type hints and has been removed.

Comment thread airflow-core/src/airflow/models/log.py Outdated
@jscheffl jscheffl merged commit 562a463 into apache:v3-1-test Jan 7, 2026
63 checks passed
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:production-image Production image improvements and fixes type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants