Skip to content

Commit

Permalink
remove all() for scalars (apache#44219)
Browse files Browse the repository at this point in the history
* remove all() for scalars

* fix

* fix
  • Loading branch information
rawwar authored Nov 20, 2024
1 parent 47cdb84 commit e7a0511
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions airflow/api_fastapi/core_api/routes/public/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def get_assets(
assets_select.options(
subqueryload(AssetModel.consuming_dags), subqueryload(AssetModel.producing_tasks)
)
).all()
)
return AssetCollectionResponse(
assets=[AssetResponse.model_validate(asset, from_attributes=True) for asset in assets],
total_entries=total_entries,
Expand Down Expand Up @@ -153,7 +153,7 @@ def get_asset_events(
)

assets_event_select = assets_event_select.options(subqueryload(AssetEvent.created_dagruns))
assets_events = session.scalars(assets_event_select).all()
assets_events = session.scalars(assets_event_select)

return AssetEventCollectionResponse(
asset_events=[
Expand Down
4 changes: 2 additions & 2 deletions airflow/api_fastapi/core_api/routes/public/backfills.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def list_backfills(
limit=limit,
session=session,
)
backfills = session.scalars(select_stmt).all()
backfills = session.scalars(select_stmt)

return BackfillCollectionResponse(
backfills=[BackfillResponse.model_validate(x, from_attributes=True) for x in backfills],
total_entries=len(backfills),
total_entries=total_entries,
)


Expand Down
2 changes: 1 addition & 1 deletion airflow/api_fastapi/core_api/routes/public/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def get_connections(
session=session,
)

connections = session.scalars(connection_select).all()
connections = session.scalars(connection_select)

return ConnectionCollectionResponse(
connections=[
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_fastapi/core_api/routes/public/dag_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def list_dag_warnings(
select(DagWarning), [warning_type, dag_id], order_by, offset, limit, session
)

dag_warnings = session.scalars(dag_warnings_select).all()
dag_warnings = session.scalars(dag_warnings_select)

return DAGWarningCollectionResponse(
dag_warnings=[
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_fastapi/core_api/routes/public/dags.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_dags(
session,
)

dags = session.scalars(dags_select).all()
dags = session.scalars(dags_select)

return DAGCollectionResponse(
dags=[DAGResponse.model_validate(dag, from_attributes=True) for dag in dags],
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_fastapi/core_api/routes/public/event_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def get_event_logs(
limit,
session,
)
event_logs = session.scalars(event_logs_select).all()
event_logs = session.scalars(event_logs_select)

return EventLogCollectionResponse(
event_logs=[
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_fastapi/core_api/routes/public/import_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get_import_errors(
limit,
session,
)
import_errors = session.scalars(import_errors_select).all()
import_errors = session.scalars(import_errors_select)

return ImportErrorCollectionResponse(
import_errors=[
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_fastapi/core_api/routes/public/pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def get_pools(
session=session,
)

pools = session.scalars(pools_select).all()
pools = session.scalars(pools_select)

return PoolCollectionResponse(
pools=[PoolResponse.model_validate(pool, from_attributes=True) for pool in pools],
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_fastapi/core_api/routes/public/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_variables(
session=session,
)

variables = session.scalars(variable_select).all()
variables = session.scalars(variable_select)

return VariableCollectionResponse(
variables=[VariableResponse.model_validate(variable, from_attributes=True) for variable in variables],
Expand Down

0 comments on commit e7a0511

Please sign in to comment.