Skip to content

Fix single item query return type #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions sqlalchemy-stubs/orm/session.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Optional, Type, TypeVar, Union, overload
from typing import Any, Optional, Tuple, Type, TypeVar, overload

from sqlalchemy import Column
from sqlalchemy.orm.query import Query
Expand Down Expand Up @@ -66,9 +66,11 @@ class Session(_SessionClassMethods):
def bind_table(self, table, bind): ...
def get_bind(self, mapper: Optional[Any] = ..., clause: Optional[Any] = ...): ...
@overload
def query(self, entity: Union[Type[_T], Column[_T]], **kwargs) -> Query[_T]: ...
def query(self, entity: Type[_T], **kwargs) -> Query[_T]: ...
@overload
def query(self, *entities, **kwargs) -> Query: ...
def query(self, entity: Column[_T], **kwargs) -> Query[Tuple[_T]]: ...
@overload
def query(self, *entities, **kwargs) -> Query[Any]: ... # plugin is needed for precise type
@property
def no_autoflush(self): ...
def refresh(self, instance, attribute_names: Optional[Any] = ..., lockmode: Optional[Any] = ...): ...
Expand Down