Skip to content

Commit

Permalink
fixup! Use session.scalar() with limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ephraimbuddy committed May 30, 2023
1 parent a926956 commit c64be9f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions airflow/jobs/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def most_recent_job(job_type: str, session: Session = NEW_SESSION) -> Job | None
:param job_type: job type to query for to get the most recent job for
:param session: Database session
"""
return session.scalars(
return session.scalar(
select(Job)
.where(Job.job_type == job_type)
.order_by(
Expand All @@ -261,7 +261,7 @@ def most_recent_job(job_type: str, session: Session = NEW_SESSION) -> Job | None
Job.latest_heartbeat.desc(),
)
.limit(1)
).first()
)


@provide_session
Expand Down

0 comments on commit c64be9f

Please sign in to comment.