Skip to content

Commit 79bbc16

Browse files
committed
Use correct import
1 parent e0233f6 commit 79bbc16

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

fastapi_pagination/ext/beanie.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
__all__ = ["paginate"]
22

3-
from typing import Any, List, Optional, Tuple, Type, TypeVar, Union
3+
from typing import TYPE_CHECKING, Any, List, Optional, Tuple, Type, TypeVar, Union
44

55
from beanie import Document
66
from beanie.odm.enums import SortDirection
7-
from beanie.odm.interfaces.aggregate import ClientSession, DocumentProjectionType
7+
from beanie.odm.interfaces.aggregate import DocumentProjectionType
88
from beanie.odm.queries.aggregation import AggregationQuery
99
from beanie.odm.queries.find import FindMany
1010

@@ -13,6 +13,10 @@
1313
from ..types import AdditionalData, AsyncItemsTransformer
1414
from ..utils import verify_params
1515

16+
if TYPE_CHECKING:
17+
from motor.motor_asyncio import AsyncIOMotorClientSession
18+
19+
1620
TDocument = TypeVar("TDocument", bound=Document)
1721

1822

@@ -24,7 +28,7 @@ async def paginate(
2428
additional_data: Optional[AdditionalData] = None,
2529
projection_model: Optional[Type[DocumentProjectionType]] = None,
2630
sort: Union[None, str, List[Tuple[str, SortDirection]]] = None,
27-
session: Optional[ClientSession] = None,
31+
session: Optional[AsyncIOMotorClientSession] = None,
2832
ignore_cache: bool = False,
2933
fetch_links: bool = False,
3034
lazy_parse: bool = False,

0 commit comments

Comments
 (0)