Skip to content

[v3-4-test] Fix ORM models failing to configure in processes that skip database setup (#74642) - #74971

Merged
vatsrahul1001 merged 3 commits into
v3-4-testfrom
backport-d79c0b1-v3-4-test
Oct 18, 2026
Merged

vatsrahul1001 merged 3 commits into
v3-4-testfrom
backport-d79c0b1-v3-4-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Models name each other in string relationships, which only resolve once
every model module is imported. The before_configured hook that imports
them all was registered in configure_orm(), so a process that skips it
(virtualenv-mode subprocesses, a task re-executed for run_as_user,
non-DB tests) or configures mappers before it runs (local settings)
only worked if it had already imported the right model modules. If it
had not, building a model failed, for example with Team.dag_bundles
unable to find DagBundleModel.

Register the hook in airflow.models.base, before any model class is
defined, and drop the test-only copy from the pytest plugin. Remove the
orm_event_handlers test: it guarded the line that moved, and now passes
whatever the code does.
(cherry picked from commit d79c0b1)

Co-authored-by: Kaxil Naik kaxilnaik@gmail.com

…p database setup (#74642)

Models name each other in string relationships, which only resolve once
every model module is imported. The before_configured hook that imports
them all was registered in configure_orm(), so a process that skips it
(virtualenv-mode subprocesses, a task re-executed for run_as_user,
non-DB tests) or configures mappers before it runs (local settings)
only worked if it had already imported the right model modules. If it
had not, building a model failed, for example with Team.dag_bundles
unable to find DagBundleModel.

Register the hook in airflow.models.base, before any model class is
defined, and drop the test-only copy from the pytest plugin. Remove the
orm_event_handlers test: it guarded the line that moved, and now passes
whatever the code does.
(cherry picked from commit d79c0b1)

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
@vatsrahul1001

Copy link
Copy Markdown
Contributor

OL compat 3.4.0 failure is expected and safe to merge past — that image/package isn't published until GA, so the 3.4.0 cell fails during beta/RC while all older versions pass. #74997 fixes it by skipping the unreleased current version from the matrix.

@vatsrahul1001
vatsrahul1001 merged commit 1579e83 into v3-4-test Oct 18, 2026
125 checks passed
@vatsrahul1001
vatsrahul1001 deleted the backport-d79c0b1-v3-4-test branch October 18, 2026 18:14
@github-actions github-actions Bot added this to the Airflow 3.4.1 milestone Oct 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.4.1 based on: bug fix merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

vatsrahul1001 added a commit that referenced this pull request Oct 20, 2026
…p database setup (#74642) (#74971)

Models name each other in string relationships, which only resolve once
every model module is imported. The before_configured hook that imports
them all was registered in configure_orm(), so a process that skips it
(virtualenv-mode subprocesses, a task re-executed for run_as_user,
non-DB tests) or configures mappers before it runs (local settings)
only worked if it had already imported the right model modules. If it
had not, building a model failed, for example with Team.dag_bundles
unable to find DagBundleModel.

Register the hook in airflow.models.base, before any model class is
defined, and drop the test-only copy from the pytest plugin. Remove the
orm_event_handlers test: it guarded the line that moved, and now passes
whatever the code does.
(cherry picked from commit d79c0b1)

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Co-authored-by: Rahul Vats <43964496+vatsrahul1001@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants