diff --git a/fastapi_sqlalchemy_toolkit/model_manager.py b/fastapi_sqlalchemy_toolkit/model_manager.py index a56a503..76ef749 100644 --- a/fastapi_sqlalchemy_toolkit/model_manager.py +++ b/fastapi_sqlalchemy_toolkit/model_manager.py @@ -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(