Skip to content

Commit ff5abde

Browse files
committed
fix: make get_or_none compatible with lower version
1 parent 51ba671 commit ff5abde

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

examples/service/routers/account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async def create_view():
2929
async def update_view(
3030
aid: int = Query(...),
3131
):
32-
account = await AccountMgr.get_by_pk(aid)
32+
account = await AccountMgr.get_by_pk(pk=aid, conn=AccountMgr.rw_conn)
3333
if not account:
3434
return {"found": False, "ok": False}
3535

fastapi_esql/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
timing,
1717
)
1818

19-
__version__ = "0.0.2"
19+
__version__ = "0.0.3"
2020

2121
__all__ = [
2222
"QsParsingError",

fastapi_esql/orm/base_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313

1414
class BaseManager(metaclass=AppMetaclass):
1515

16-
model = Model
16+
model: Model = Model
1717

1818
@classmethod
1919
async def get_by_pk(
2020
cls,
2121
pk: Any,
2222
conn: Optional[BaseDBAsyncClient] = None,
2323
) -> Optional[Model]:
24-
return await cls.model.get_or_none(pk=pk, using_db=conn)
24+
return await cls.model.get_or_none(pk=pk).using_db(conn)
2525

2626
@classmethod
2727
async def create_from_dict(cls, params: Dict[str, Any]) -> Optional[Model]:

0 commit comments

Comments
 (0)