From 3217ce3c958bcfe34e3d76cae944246a0e54d784 Mon Sep 17 00:00:00 2001 From: Hadrien David Date: Fri, 2 May 2025 07:49:53 -0400 Subject: [PATCH 1/2] docs: add imports in some examples --- docs/pagination.md | 2 +- src/fastsqla.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/pagination.md b/docs/pagination.md index ec47648..8358739 100644 --- a/docs/pagination.md +++ b/docs/pagination.md @@ -15,7 +15,7 @@ heading_level: false show_source: false -### `SQLAlchemy` example +## `SQLAlchemy` example ``` py title="example.py" hl_lines="25 26 27" from fastapi import FastAPI diff --git a/src/fastsqla.py b/src/fastsqla.py index c0c260d..7795620 100644 --- a/src/fastsqla.py +++ b/src/fastsqla.py @@ -230,7 +230,10 @@ async def new_session() -> AsyncGenerator[AsyncSession, None]: Example: -``` py title="example.py" hl_lines="3" +``` py title="example.py" hl_lines="6" +from fastsqla import Item, Session +... + @app.get("/heros/{hero_id}", response_model=Item[HeroItem]) async def get_items( session: Session, # (1)! @@ -252,6 +255,10 @@ async def get_items( the session instead: ```python +from fastsqla import Item, Session +... + + @app.post("/heros", response_model=Item[HeroItem]) async def create_item(session: Session, new_hero: HeroBase): hero = Hero(**new_hero.model_dump()) From 4b26774934bfb98845d6747dd9322c4dc0098dba Mon Sep 17 00:00:00 2001 From: Hadrien David Date: Fri, 2 May 2025 07:52:00 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=92=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/pagination.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pagination.md b/docs/pagination.md index 8358739..c4d4885 100644 --- a/docs/pagination.md +++ b/docs/pagination.md @@ -64,7 +64,7 @@ async def list_heros(paginate: Paginate, age:int | None = None): return await paginate(stmt) ``` -### `SQLModel` example +## `SQLModel` example ```python from fastapi import FastAPI