The GitHub Actions job "Tests" on airflow.git/2603/avoid_noload has succeeded.
Run started by GitHub user Dev-iL (triggered by vatsrahul1001).

Head commit for run:
7920321687ac09bcd1013d952c468548e174d77a / Dev-iL 
<[email protected]>
SQLA: Replace the deprecated `lazy="noload"` with `lazy="raise"`

SQLAlchemy 2.1 deprecated the `noload` lazy loading strategy
(sqlalchemy/sqlalchemy#11045). `noload` silently returns `None`/empty
collections — essentially incorrect results — and will be removed in a
future release.

This PR replaces all 5 occurrences of `lazy="noload"` with `lazy="raise"`,
which raises `InvalidRequestError` if the relationship is accessed without
an explicit eager load (e.g. `joinedload`). All affected relationships are
already properly loaded via `joinedload()` wherever they're accessed, so
this is a safe drop-in that also catches missing eager loads at development
time instead of silently returning `None`.

Two callers needed fixes to work correctly with `lazy="raise"`:
- `TaskInstance.rendered_task_instance_fields` and `TaskInstance.hitl_detail`
  needed `passive_deletes=True` to tell SQLAlchemy to rely on the DB-level
  `ON DELETE CASCADE` rather than attempting ORM-level cascade processing
  (which would fail since FK columns are also PK columns on RTIF, and
  `lazy="raise"` prevents the ORM from loading the collection to clear them).
- The HITL API endpoints needed `joinedload(TI.rendered_task_instance_fields)`
  added to their queries, since `TaskInstanceResponse` accesses
  `rendered_task_instance_fields` during Pydantic serialization. The
  `get_hitl_detail` endpoint also needed an explicit `model_validate()` call
  so serialization happens while the session is still active.

**Changed models:**
- `Log.task_instance`
- `TaskInstance.rendered_task_instance_fields`
- `TaskInstance.hitl_detail`
- `TaskInstanceHistory.hitl_detail`
- `XComModel.task`

related: #61229

Report URL: https://github.com/apache/airflow/actions/runs/23665351961

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to