This is an automated email from the ASF dual-hosted git repository.
pierrejeambrun pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new d384145f4be [v3-1-test] Add number of queries guard for ui backfill
(#57820) (#57856)
d384145f4be is described below
commit d384145f4beb8b8e9ce7891acac6a29ef07a6497
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Nov 7 14:59:45 2025 +0100
[v3-1-test] Add number of queries guard for ui backfill (#57820) (#57856)
(cherry picked from commit 34dec40e70d21b77092ce5ba7a15b2a80d57f47b)
Co-authored-by: Pierre Jeambrun <[email protected]>
---
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/backfills.py | 3 ++-
.../tests/unit/api_fastapi/core_api/routes/ui/test_backfills.py | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git
a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/backfills.py
b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/backfills.py
index e0f310f7043..24bf0f66fc3 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/backfills.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/backfills.py
@@ -20,6 +20,7 @@ from typing import Annotated
from fastapi import Depends, status
from sqlalchemy import select
+from sqlalchemy.orm import joinedload
from airflow.api_fastapi.common.db.common import SessionDep, paginated_select
from airflow.api_fastapi.common.parameters import (
@@ -64,7 +65,7 @@ def list_backfills_ui(
],
) -> BackfillCollectionResponse:
select_stmt, total_entries = paginated_select(
- statement=select(Backfill),
+ statement=select(Backfill).options(joinedload(Backfill.dag_model)),
filters=[dag_id, active],
order_by=order_by,
offset=offset,
diff --git
a/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_backfills.py
b/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_backfills.py
index 5e355f83b66..8b7bdde96d5 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_backfills.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_backfills.py
@@ -25,6 +25,7 @@ from airflow.models import DagModel
from airflow.models.backfill import Backfill
from airflow.utils.session import provide_session
+from tests_common.test_utils.asserts import assert_queries_count
from tests_common.test_utils.db import (
clear_db_backfills,
clear_db_dag_bundles,
@@ -152,7 +153,8 @@ class TestListBackfills(TestBackfillEndpoint):
expected_response = []
for backfill in response_params:
expected_response.append(backfill_responses[backfill])
- response = test_client.get("/backfills", params=test_params)
+ with assert_queries_count(2):
+ response = test_client.get("/backfills", params=test_params)
assert response.status_code == 200
assert response.json() == {
"backfills": expected_response,