Skip to content

Commit

Permalink
Merge pull request #31 from sfrvn/detail-scalar-one
Browse files Browse the repository at this point in the history
fix: scalar_one_or_none in detail
  • Loading branch information
e-kondr01 authored Oct 16, 2024
2 parents 8c0698e + eb1afb1 commit 229d940
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fastapi_sqlalchemy_toolkit/model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ async def get(

result = await session.execute(stmt)
if base_stmt is None:
return result.scalars().first()
if order_by is not None:
return result.scalars().first()
return result.scalar_one_or_none()
return result.first()

async def get_or_404(
Expand Down

0 comments on commit 229d940

Please sign in to comment.