Skip to content

Commit

Permalink
Fix single item query return type (#199)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Levkivskyi <[email protected]>
  • Loading branch information
ilevkivskyi and Ivan Levkivskyi authored Jan 8, 2021
1 parent 936423b commit 84e1ebd
Showing 1 changed file with 5 additions and 3 deletions.
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

1 comment on commit 84e1ebd

@NotarySigningAgent
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.