diff --git a/sqlalchemy-stubs/orm/query.pyi b/sqlalchemy-stubs/orm/query.pyi index bc89cdd..75a1d5a 100644 --- a/sqlalchemy-stubs/orm/query.pyi +++ b/sqlalchemy-stubs/orm/query.pyi @@ -1,7 +1,7 @@ -from typing import Any, Optional, Union, TypeVar, Generic, List, Iterator +from typing import Any, Dict, Optional, Union, TypeVar, Generic, List, Iterator from . import interfaces from .base import InspectionAttr -from ..sql.selectable import ForUpdateArg, Alias, CTE +from ..sql.selectable import ForUpdateArg, Alias, CTE, Select from ..sql.elements import Label from .session import Session @@ -22,7 +22,7 @@ class Query(Generic[_T]): def label(self, name: str) -> Label: ... def as_scalar(self): ... @property - def selectable(self): ... + def selectable(self) -> Select: ... def __clause_element__(self): ... def enable_eagerloads(self: _Q, value: bool) -> _Q: ... def with_labels(self: _Q) -> _Q: ... @@ -36,11 +36,11 @@ class Query(Generic[_T]): def correlate(self, *args): ... def autoflush(self: _Q, setting: bool) -> _Q: ... def populate_existing(self: _Q) -> _Q: ... - def with_parent(self, instance, property: Optional[Any] = ...): ... + def with_parent(self: _Q, instance, property: Optional[Any] = ...) -> _Q: ... def add_entity(self, entity, alias: Optional[Any] = ...): ... def with_session(self: _Q, session: Optional[Session]) -> _Q: ... - def from_self(self, *entities): ... - def values(self, *columns): ... + def from_self(self: _Q, *entities) -> _Q: ... + def values(self, *columns) -> Iterator[_T]: ... def value(self, column): ... def with_entities(self, *entities): ... def add_columns(self, *column): ... @@ -61,37 +61,37 @@ class Query(Generic[_T]): def having(self: _Q, criterion) -> _Q: ... def union(self, *q): ... def union_all(self, *q): ... - def intersect(self, *q): ... - def intersect_all(self, *q): ... - def except_(self, *q): ... - def except_all(self, *q): ... - def join(self, *props, **kwargs): ... - def outerjoin(self, *props, **kwargs): ... - def reset_joinpoint(self): ... - def select_from(self, *from_obj): ... - def select_entity_from(self, from_obj): ... + def intersect(self: _Q, *q) -> _Q: ... + def intersect_all(self: _Q, *q) -> _Q: ... + def except_(self: _Q, *q): ... + def except_all(self: _Q, *q) -> _Q: ... + def join(self: _Q, *props, **kwargs) -> _Q: ... + def outerjoin(self: _Q, *props, **kwargs) -> _Q: ... + def reset_joinpoint(self: _Q) -> _Q: ... + def select_from(self: _Q, *from_obj) -> _Q: ... + def select_entity_from(self: _Q, from_obj) -> _Q: ... def __getitem__(self, item): ... def slice(self: _Q, start: Optional[int], stop: Optional[int]) -> _Q: ... def limit(self: _Q, limit: Optional[int]) -> _Q: ... def offset(self: _Q, offset: Optional[int]) -> _Q: ... - def distinct(self, *criterion): ... - def prefix_with(self, *prefixes): ... - def suffix_with(self, *suffixes): ... + def distinct(self: _Q, *criterion) -> _Q: ... + def prefix_with(self: _Q, *prefixes) -> _Q: ... + def suffix_with(self: _Q, *suffixes) -> _Q: ... def all(self) -> List[_T]: ... - def from_statement(self, statement): ... + def from_statement(self: _Q, statement) -> _Q: ... def first(self) -> Optional[_T]: ... def one_or_none(self) -> Optional[_T]: ... def one(self) -> _T: ... def scalar(self): ... def __iter__(self) -> Iterator[_T]: ... @property - def column_descriptions(self): ... + def column_descriptions(self) -> List[Dict[str, Any]]: ... def instances(self, cursor, __context: Optional[Any] = ...): ... def merge_result(self, iterator, load: bool = ...): ... def exists(self): ... def count(self) -> int: ... def delete(self, synchronize_session: Union[bool, str] = ...) -> int: ... - def update(self, values, synchronize_session: Union[bool, str] = ..., update_args: Optional[Any] = ...): ... + def update(self, values, synchronize_session: Union[bool, str] = ..., update_args: Optional[Any] = ...) -> int: ... class LockmodeArg(ForUpdateArg): @classmethod