forked from absent1706/sqlalchemy-mixins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smartquery.pyi
62 lines (44 loc) · 1.59 KB
/
smartquery.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import sys
from typing import Union, Type, List, Optional, Iterable, Dict, Any, TypeVar
if sys.version_info > (3, 6):
from typing import OrderedDict
else:
OrderedDict = TypeVar('OrderedDict', bound=Any)
from sqlalchemy.orm import Query
from sqlalchemy.orm.util import AliasedClass
from sqlalchemy_mixins.eagerload import EagerLoadMixin
from sqlalchemy_mixins.inspection import InspectionMixin
from sqlalchemy_mixins.utils import classproperty
def _parse_path_and_make_aliases(
entity: Union[Type[InspectionMixin], AliasedClass],
entity_path: str,
attrs: List[str],
aliases: OrderedDict
) -> None: ...
def _get_root_cls(query: Query) -> Type[InspectionMixin]: ...
def smart_query(
query: Query,
filters: Optional[Dict[str, Any]] = None,
sort_attrs: Optional[Iterable[str]] = None,
schema: Optional[dict] = None
) -> Query: ...
class SmartQueryMixin(InspectionMixin, EagerLoadMixin):
@classproperty
def filterable_attributes(cls) -> List[str]: ...
@classproperty
def sortable_attributes(cls) -> List[str]: ...
@classmethod
def filter_expr(cls_or_alias, **filters: dict) -> list: ...
@classmethod
def order_expr(cls_or_alias, *columns: str) -> list: ...
@classmethod
def smart_query(
cls,
filters: Optional[Dict[str, Any]] = None,
sort_attrs: Optional[Iterable[str]] = None,
schema: Optional[dict] = None
) -> Query: ...
@classmethod
def where(cls, **filters: Any) -> Query: ...
@classmethod
def sort(cls, *columns: str) -> Query: ...