This is an automated email from the ASF dual-hosted git repository.

ashb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7e448f70af5 Use async database access for Variable key listing (#73407)
7e448f70af5 is described below

commit 7e448f70af577981ccefa82aa36f3a3f8bffb927
Author: Dev-iL <[email protected]>
AuthorDate: Sun Oct 4 19:59:55 2026 +0300

    Use async database access for Variable key listing (#73407)
    
    Variable key requests should release threadpool workers while waiting for 
database reads, alongside the other async Execution API read endpoints.
---
 .../src/airflow/api_fastapi/execution_api/routes/variables.py  | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/airflow-core/src/airflow/api_fastapi/execution_api/routes/variables.py 
b/airflow-core/src/airflow/api_fastapi/execution_api/routes/variables.py
index 631ad35ded1..5b1c15cdd27 100644
--- a/airflow-core/src/airflow/api_fastapi/execution_api/routes/variables.py
+++ b/airflow-core/src/airflow/api_fastapi/execution_api/routes/variables.py
@@ -23,7 +23,7 @@ from typing import Annotated
 from fastapi import APIRouter, Depends, HTTPException, Path, Query, Request, 
status
 from sqlalchemy import func, select
 
-from airflow.api_fastapi.common.db.common import SessionDep
+from airflow.api_fastapi.common.db.common import AsyncSessionDep
 from airflow.api_fastapi.execution_api.datamodels.variable import (
     VariableKeysResponse,
     VariablePostBody,
@@ -72,8 +72,8 @@ log = logging.getLogger(__name__)
         status.HTTP_401_UNAUTHORIZED: {"description": "Unauthorized"},
     },
 )
-def get_variable_keys(
-    session: SessionDep,
+async def get_variable_keys(
+    session: AsyncSessionDep,
     team_name: Annotated[str | None, Depends(get_team_name_dep)] = None,
     prefix: Annotated[str | None, Query()] = None,
     limit: Annotated[int, Query(ge=1, le=10_000)] = 1000,
@@ -96,8 +96,8 @@ def get_variable_keys(
     if team_name is not None:
         stmt = stmt.where(Variable.team_name == team_name)
 
-    total_entries = 
session.scalar(select(func.count()).select_from(stmt.subquery())) or 0
-    keys = session.scalars(stmt.offset(offset).limit(limit)).all()
+    total_entries = await 
session.scalar(select(func.count()).select_from(stmt.subquery())) or 0
+    keys = (await session.scalars(stmt.offset(offset).limit(limit))).all()
     return VariableKeysResponse(keys=list(keys), total_entries=total_entries)
 
 

Reply via email to