File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 1515 heading_level: false
1616 show_source: false
1717
18- ### ` SQLAlchemy ` example
18+ ## ` SQLAlchemy ` example
1919
2020``` py title="example.py" hl_lines="25 26 27"
2121from fastapi import FastAPI
@@ -64,7 +64,7 @@ async def list_heros(paginate: Paginate, age:int | None = None):
6464 return await paginate(stmt)
6565```
6666
67- ### ` SQLModel ` example
67+ ## ` SQLModel ` example
6868
6969``` python
7070from fastapi import FastAPI
Original file line number Diff line number Diff line change @@ -230,7 +230,10 @@ async def new_session() -> AsyncGenerator[AsyncSession, None]:
230230
231231Example:
232232
233- ``` py title="example.py" hl_lines="3"
233+ ``` py title="example.py" hl_lines="6"
234+ from fastsqla import Item, Session
235+ ...
236+
234237@app.get("/heros/{hero_id}", response_model=Item[HeroItem])
235238async def get_items(
236239 session: Session, # (1)!
@@ -252,6 +255,10 @@ async def get_items(
252255the session instead:
253256
254257```python
258+ from fastsqla import Item, Session
259+ ...
260+
261+
255262@app.post("/heros", response_model=Item[HeroItem])
256263async def create_item(session: Session, new_hero: HeroBase):
257264 hero = Hero(**new_hero.model_dump())
You can’t perform that action at this time.
0 commit comments