fastapi updates
This commit is contained in:
@@ -81,7 +81,8 @@ Cache it by the application-owned engine so repeated composition calls return th
|
||||
```python
|
||||
from functools import cache
|
||||
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker
|
||||
from sqlalchemy.ext.asyncio import async_sessionmaker
|
||||
from sqlmodel.ext.asyncio.session import AsyncSession
|
||||
|
||||
from .engine import dispose_engine
|
||||
from .engine import get_engine
|
||||
@@ -226,7 +227,7 @@ Pass the database URL to repository constructors. The repository stores repeatab
|
||||
|
||||
```python
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlmodel.ext.asyncio.session import AsyncSession
|
||||
|
||||
|
||||
async def find_item(session: AsyncSession, item_id: int) -> Item | None:
|
||||
@@ -280,8 +281,8 @@ from collections.abc import AsyncIterator
|
||||
|
||||
from fastapi import Depends
|
||||
from fastapi import Request
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.ext.asyncio import async_sessionmaker
|
||||
from sqlmodel.ext.asyncio.session import AsyncSession
|
||||
|
||||
|
||||
type SessionFactory = async_sessionmaker[AsyncSession]
|
||||
@@ -302,7 +303,7 @@ Route usage:
|
||||
|
||||
```python
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlmodel.ext.asyncio.session import AsyncSession
|
||||
|
||||
from .session import get_db_session
|
||||
|
||||
|
||||
Reference in New Issue
Block a user