This commit is contained in:
Maxim Kurnikov
2018-08-14 12:09:47 +03:00
parent a13d4c352a
commit ca5f489092
3 changed files with 368 additions and 464 deletions

View File

@@ -8,6 +8,7 @@ from django.core.validators import DecimalValidator
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.expressions import Col, CombinedExpression
from django.db.models.fields import reverse_related
from django.db.models.fields.files import FieldFile
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.query import QuerySet

View File

@@ -1,3 +1,5 @@
import decimal
import operator
from collections import OrderedDict
from datetime import date, datetime
from decimal import Decimal
@@ -11,8 +13,6 @@ from django.contrib.contenttypes.fields import GenericForeignKey
from django.db.models.base import Model, ModelState
from django.db.models.expressions import Expression
from django.db.models.fields import Field
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.related_descriptors import (ForwardManyToOneDescriptor,
ReverseOneToOneDescriptor)
from django.db.models.query_utils import Q
@@ -21,206 +21,277 @@ from django.db.models.sql.query import Query, RawQuery
REPR_OUTPUT_SIZE: int
EmptyResultSet: Any
class BaseIterable:
queryset: Any = ...
chunked_fetch: Any = ...
chunk_size: Any = ...
def __init__(
self,
queryset: QuerySet,
chunked_fetch: bool = ...,
chunk_size: int = ...,
self,
queryset: QuerySet,
chunked_fetch: bool = ...,
chunk_size: int = ...,
) -> None: ...
class ModelIterable(BaseIterable):
chunk_size: int
chunked_fetch: bool
queryset: django.db.models.query.QuerySet
def __iter__(self) -> Iterator[Model]: ...
class ValuesIterable(BaseIterable):
chunk_size: int
chunked_fetch: bool
queryset: django.db.models.query.QuerySet
def __iter__(self) -> Iterator[Dict[str, Optional[Union[int, str]]]]: ...
class ValuesListIterable(BaseIterable):
chunk_size: int
chunked_fetch: bool
queryset: django.db.models.query.QuerySet
def __iter__(self) -> Union[chain, map]: ...
class NamedValuesListIterable(ValuesListIterable):
chunk_size: int
chunked_fetch: bool
queryset: django.db.models.query.QuerySet
queryset: QuerySet
@staticmethod
def create_namedtuple_class(*names: Any) -> Any: ...
def __iter__(self) -> Any: ...
class FlatValuesListIterable(BaseIterable):
chunk_size: int
chunked_fetch: bool
queryset: django.db.models.query.QuerySet
queryset: QuerySet
def __iter__(self) -> Iterator[Any]: ...
class QuerySet:
model: Optional[Type[django.db.models.base.Model]] = ...
query: django.db.models.sql.query.Query = ...
def __init__(
self,
model: Optional[Type[Model]] = ...,
query: Optional[Query] = ...,
using: Optional[str] = ...,
hints: Optional[Dict[str, Model]] = ...,
self,
model: Optional[Type[Model]] = ...,
query: Optional[Query] = ...,
using: Optional[str] = ...,
hints: Optional[Dict[str, Model]] = ...,
) -> None: ...
def as_manager(cls): ...
as_manager: Any = ...
def __deepcopy__(
self,
memo: Dict[
int,
Union[
Dict[str, Union[ModelState, int, str]],
List[Union[Dict[str, Union[bool, str]], ModelState]],
Model,
ModelState,
self,
memo: Dict[
int,
Union[
Dict[str, Union[ModelState, int, str]],
List[Union[Dict[str, Union[bool, str]], ModelState]],
Model,
ModelState,
],
],
],
) -> QuerySet: ...
def __len__(self) -> int: ...
def __iter__(self) -> Any: ...
def __bool__(self) -> bool: ...
def __getitem__(self, k: Union[int, slice, str]) -> Any: ...
def __and__(self, other: QuerySet) -> QuerySet: ...
def __or__(self, other: QuerySet) -> QuerySet: ...
def iterator(self, chunk_size: int = ...) -> Iterator[Any]: ...
def aggregate(
self, *args: Any, **kwargs: Any
self, *args: Any, **kwargs: Any
) -> Dict[str, Optional[Union[datetime, float]]]: ...
def count(self) -> int: ...
def get(
self, *args: Any, **kwargs: Any
self, *args: Any, **kwargs: Any
) -> Union[
Dict[str, Union[date, Decimal, float, str]],
Tuple[Union[Decimal, str]],
Model,
str,
]: ...
def create(self, **kwargs: Any) -> Model: ...
def bulk_create(
self,
objs: Union[Iterator[Any], List[Model]],
batch_size: Optional[int] = ...,
self,
objs: Union[Iterator[Any], List[Model]],
batch_size: Optional[int] = ...,
) -> List[Model]: ...
def get_or_create(
self,
defaults: Optional[Union[Dict[str, date], Dict[str, Model]]] = ...,
**kwargs: Any
self,
defaults: Optional[Union[Dict[str, date], Dict[str, Model]]] = ...,
**kwargs: Any
) -> Tuple[Model, bool]: ...
def update_or_create(
self,
defaults: Optional[
Union[
Dict[str, Callable],
Dict[str, date],
Dict[str, Model],
Dict[str, str],
]
] = ...,
**kwargs: Any
self,
defaults: Optional[
Union[
Dict[str, Callable],
Dict[str, date],
Dict[str, Model],
Dict[str, str],
]
] = ...,
**kwargs: Any
) -> Tuple[Model, bool]: ...
def earliest(
self, *fields: Any, field_name: Optional[Any] = ...
self, *fields: Any, field_name: Optional[Any] = ...
) -> Model: ...
def latest(
self, *fields: Any, field_name: Optional[Any] = ...
self, *fields: Any, field_name: Optional[Any] = ...
) -> Model: ...
def first(self) -> Optional[Union[Dict[str, int], Model]]: ...
def last(self) -> Optional[Model]: ...
def in_bulk(
self, id_list: Any = ..., *, field_name: str = ...
self, id_list: Any = ..., *, field_name: str = ...
) -> Union[Dict[int, Model], Dict[str, Model]]: ...
def delete(self) -> Tuple[int, Dict[str, int]]: ...
def update(self, **kwargs: Any) -> int: ...
def exists(self) -> bool: ...
def explain(
self, *, format: Optional[Any] = ..., **options: Any
self, *, format: Optional[Any] = ..., **options: Any
) -> str: ...
def raw(
self,
raw_query: str,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple[int],
]
] = ...,
translations: Optional[Dict[str, str]] = ...,
using: None = ...,
self,
raw_query: str,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple[int],
]
] = ...,
translations: Optional[Dict[str, str]] = ...,
using: None = ...,
) -> RawQuerySet: ...
def values(self, *fields: Any, **expressions: Any) -> QuerySet: ...
def values_list(
self, *fields: Any, flat: bool = ..., named: bool = ...
self, *fields: Any, flat: bool = ..., named: bool = ...
) -> QuerySet: ...
def dates(
self, field_name: str, kind: str, order: str = ...
self, field_name: str, kind: str, order: str = ...
) -> QuerySet: ...
def datetimes(
self, field_name: str, kind: str, order: str = ..., tzinfo: None = ...
self, field_name: str, kind: str, order: str = ..., tzinfo: None = ...
) -> QuerySet: ...
def none(self) -> QuerySet: ...
def all(self) -> QuerySet: ...
def filter(self, *args: Any, **kwargs: Any) -> QuerySet: ...
def exclude(self, *args: Any, **kwargs: Any) -> QuerySet: ...
def complex_filter(
self,
filter_obj: Union[
Dict[str, datetime], Dict[str, QuerySet], Q, MagicMock
],
self,
filter_obj: Union[
Dict[str, datetime], Dict[str, QuerySet], Q, MagicMock
],
) -> QuerySet: ...
def union(self, *other_qs: Any, all: bool = ...) -> QuerySet: ...
def intersection(self, *other_qs: Any) -> QuerySet: ...
def difference(self, *other_qs: Any) -> QuerySet: ...
def select_for_update(
self, nowait: bool = ..., skip_locked: bool = ..., of: Tuple = ...
self, nowait: bool = ..., skip_locked: bool = ..., of: Tuple = ...
) -> QuerySet: ...
def select_related(self, *fields: Any) -> QuerySet: ...
def prefetch_related(self, *lookups: Any) -> QuerySet: ...
def annotate(self, *args: Any, **kwargs: Any) -> QuerySet: ...
def order_by(self, *field_names: Any) -> QuerySet: ...
def distinct(self, *field_names: Any) -> QuerySet: ...
def extra(
self,
select: Optional[
Union[Dict[str, int], Dict[str, str], OrderedDict]
] = ...,
where: Optional[List[str]] = ...,
params: Optional[Union[List[int], List[str]]] = ...,
tables: Optional[List[str]] = ...,
order_by: Optional[Union[List[str], Tuple[str]]] = ...,
select_params: Optional[Union[List[int], List[str], Tuple[int]]] = ...,
self,
select: Optional[
Union[Dict[str, int], Dict[str, str], OrderedDict]
] = ...,
where: Optional[List[str]] = ...,
params: Optional[Union[List[int], List[str]]] = ...,
tables: Optional[List[str]] = ...,
order_by: Optional[Union[List[str], Tuple[str]]] = ...,
select_params: Optional[Union[List[int], List[str], Tuple[int]]] = ...,
) -> QuerySet: ...
def reverse(self) -> QuerySet: ...
def defer(self, *fields: Any) -> QuerySet: ...
def only(self, *fields: Any) -> QuerySet: ...
def using(self, alias: Optional[str]) -> QuerySet: ...
@property
def ordered(self) -> bool: ...
@property
def db(self) -> str: ...
def resolve_expression(self, *args: Any, **kwargs: Any) -> Query: ...
class InstanceCheckMeta(type):
def __instancecheck__(self, instance: Union[QuerySet, str]) -> bool: ...
class EmptyQuerySet:
def __init__(self, *args: Any, **kwargs: Any) -> Any: ...
class RawQuerySet:
columns: List[str]
model_fields: Dict[str, django.db.models.fields.Field]
@@ -236,80 +307,108 @@ class RawQuerySet:
Tuple,
] = ...
translations: Dict[str, str] = ...
def __init__(
self,
raw_query: str,
model: Optional[Type[Model]] = ...,
query: Optional[RawQuery] = ...,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple,
]
] = ...,
translations: Optional[Dict[str, str]] = ...,
using: Optional[str] = ...,
hints: Optional[Dict[Any, Any]] = ...,
self,
raw_query: str,
model: Optional[Type[Model]] = ...,
query: Optional[RawQuery] = ...,
params: Optional[
Union[
Dict[str, str],
List[datetime],
List[Decimal],
List[str],
Set[str],
Tuple,
]
] = ...,
translations: Optional[Dict[str, str]] = ...,
using: Optional[str] = ...,
hints: Optional[Dict[Any, Any]] = ...,
) -> None: ...
def resolve_model_init_order(
self
self
) -> Tuple[List[str], List[int], List[Tuple[str, int]]]: ...
def prefetch_related(self, *lookups: Any) -> RawQuerySet: ...
def __len__(self) -> int: ...
def __bool__(self) -> bool: ...
def __iter__(self) -> Any: ...
def iterator(self) -> Iterator[Model]: ...
def __getitem__(
self, k: Union[int, slice, str]
self, k: Union[int, slice, str]
) -> Union[List[Model], Model]: ...
@property
def db(self) -> str: ...
def using(self, alias: Any): ...
def columns(self) -> List[str]: ...
def model_fields(self) -> Dict[str, Field]: ...
class Prefetch:
prefetch_through: str = ...
prefetch_to: str = ...
queryset: Optional[django.db.models.query.QuerySet] = ...
to_attr: Optional[str] = ...
def __init__(
self,
lookup: str,
queryset: Optional[QuerySet] = ...,
to_attr: Optional[str] = ...,
self,
lookup: str,
queryset: Optional[QuerySet] = ...,
to_attr: Optional[str] = ...,
) -> None: ...
def add_prefix(self, prefix: str) -> None: ...
def get_current_prefetch_to(self, level: int) -> str: ...
def get_current_to_attr(self, level: int) -> Tuple[str, Optional[bool]]: ...
def get_current_queryset(self, level: int) -> Optional[QuerySet]: ...
def __eq__(self, other: None) -> bool: ...
def __hash__(self) -> int: ...
def normalize_prefetch_lookups(
lookups: reversed, prefix: None = ...
lookups: reversed, prefix: None = ...
) -> List[Prefetch]: ...
def prefetch_related_objects(
model_instances: Union[List[Model], List[UUID]], *related_lookups: Any
model_instances: Union[List[Model], List[UUID]], *related_lookups: Any
) -> None: ...
def get_prefetcher(
instance: Model, through_attr: str, to_attr: str
instance: Model, through_attr: str, to_attr: str
) -> Tuple[
GenericForeignKey, Union[GenericForeignKey, property], bool, bool
]: ...
def prefetch_one_level(
instances: List[Model],
prefetcher: Union[
GenericForeignKey, ForwardManyToOneDescriptor, ReverseOneToOneDescriptor
],
lookup: Prefetch,
level: int,
instances: List[Model],
prefetcher: Union[
GenericForeignKey, ForwardManyToOneDescriptor, ReverseOneToOneDescriptor
],
lookup: Prefetch,
level: int,
) -> Tuple[List[Model], List[Prefetch]]: ...
class RelatedPopulator:
db: str = ...
cols_start: int = ...
@@ -321,186 +420,27 @@ class RelatedPopulator:
related_populators: List[django.db.models.query.RelatedPopulator] = ...
local_setter: Callable = ...
remote_setter: Callable = ...
def __init__(
self,
klass_info: Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
FieldCacheMixin,
],
],
select: List[Tuple[Expression, Tuple[str, List[int]], Optional[str]]],
db: str,
) -> None: ...
def populate(
self,
row: Union[
List[Optional[Union[date, int, str]]],
List[Union[date, Decimal, float, str]],
Tuple[Union[int, str], str, int],
],
from_obj: Model,
self,
klass_info: Dict[str, Any],
select: List[Tuple[Expression, Tuple[str, List[int]], Optional[str]]],
db: str,
) -> None: ...
def get_related_populators(
klass_info: Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
int
],
Type[
Model
],
bool,
ForeignKey,
],
]
],
List[
int
],
Type[
Model
],
bool,
ForeignKey,
],
]
],
List[
int
],
Type[
Model
],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
FieldCacheMixin,
],
]
def populate(
self,
row: Union[
List[Optional[Union[date, int, str]]],
List[Union[date, Decimal, float, str]],
Tuple[Union[int, str], str, int],
],
List[int],
Type[Model],
bool,
FieldCacheMixin,
],
],
select: List[Tuple[Expression, Tuple[str, List[bool]], Optional[str]]],
db: str,
from_obj: Model,
) -> None: ...
def get_related_populators(
klass_info: Dict[str, Any],
select: List[Tuple[Expression, Tuple[str, List[bool]], Optional[str]]],
db: str,
) -> List[RelatedPopulator]: ...

View File

@@ -5,15 +5,12 @@ from typing import (Any, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Type, Union)
from uuid import UUID
from django.contrib.contenttypes.models import ContentType
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from django.db.models.base import Model
from django.db.models.expressions import (BaseExpression, Col, Expression,
OrderBy, RawSQL, SQLiteNumericMixin)
from django.db.models.fields import DateTimeCheckMixin, Field
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import ForeignKey
from django.db.models.functions.text import Lower
from django.db.models.options import Options
from django.db.models.sql.query import Query, RawQuery
@@ -21,6 +18,7 @@ from django.utils.datastructures import ImmutableList
FORCE: Any
class SQLCompiler:
query: Any = ...
connection: Any = ...
@@ -30,17 +28,22 @@ class SQLCompiler:
annotation_col_map: Any = ...
klass_info: Any = ...
ordering_parts: Any = ...
def __init__(
self,
query: Union[Query, RawQuery],
connection: DatabaseWrapper,
using: Optional[str],
self,
query: Union[Query, RawQuery],
connection: DatabaseWrapper,
using: Optional[str],
) -> None: ...
col_count: Any = ...
def setup_query(self) -> None: ...
has_extra_select: Any = ...
def pre_sql_setup(
self
self
) -> Tuple[
List[
Tuple[OrderBy, Tuple[str, Union[List[Any], Tuple[str, str]]], None]
@@ -48,24 +51,27 @@ class SQLCompiler:
List[Tuple[OrderBy, Tuple[str, List[Union[int, str]], bool]]],
List[Tuple[str, List[float]]],
]: ...
def get_group_by(
self,
select: List[
Tuple[
Union[BaseExpression, SQLiteNumericMixin],
Tuple[str, List[float]],
Optional[str],
]
],
order_by: List[Tuple[OrderBy, Tuple[str, List[Union[int, str]], bool]]],
self,
select: List[
Tuple[
Union[BaseExpression, SQLiteNumericMixin],
Tuple[str, List[float]],
Optional[str],
]
],
order_by: List[Tuple[OrderBy, Tuple[str, List[Union[int, str]], bool]]],
) -> List[Tuple[str, List[float]]]: ...
def collapse_group_by(
self,
expressions: List[Expression],
having: Union[List[Expression], Tuple],
self,
expressions: List[Expression],
having: Union[List[Expression], Tuple],
) -> List[Expression]: ...
def get_select(
self
self
) -> Tuple[
List[
Tuple[
@@ -75,153 +81,91 @@ class SQLCompiler:
]
],
Optional[
Dict[
str,
Union[
List[
Dict[
str,
Union[
Callable,
List[int],
Type[ContentType],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
],
]
Dict[str, Any]
],
Dict[str, int],
]: ...
def get_order_by(
self
self
) -> List[Tuple[OrderBy, Tuple[str, List[Any], bool]]]: ...
def get_extra_select(
self,
order_by: List[Tuple[OrderBy, Tuple[str, List[Any], bool]]],
select: List[
Tuple[
Union[Expression, SQLiteNumericMixin],
Tuple[str, List[float]],
Optional[str],
]
],
) -> List[Tuple[OrderBy, Tuple[str, List[Any]], None]]: ...
def quote_name_unless_alias(self, name: str) -> str: ...
def compile(
self, node: Any, select_format: Any = ...
) -> Tuple[str, Union[List[Optional[int]], Tuple[int, int]]]: ...
def get_combinator_sql(
self, combinator: str, all: bool
) -> Tuple[List[str], Union[List[int], List[str]]]: ...
def as_sql(
self, with_limits: bool = ..., with_col_aliases: bool = ...
) -> Any: ...
def get_default_columns(
self,
start_alias: Optional[str] = ...,
opts: Optional[Options] = ...,
from_parent: Optional[Type[Model]] = ...,
) -> List[Col]: ...
def get_distinct(self) -> Tuple[List[Any], List[Any]]: ...
def find_ordering_name(
self,
name: str,
opts: Options,
alias: Optional[str] = ...,
default_order: str = ...,
already_seen: Optional[
Set[Tuple[Optional[Tuple[Tuple[str, str]]], Tuple[Tuple[str, str]]]]
] = ...,
) -> List[Tuple[OrderBy, bool]]: ...
def get_from_clause(self) -> Tuple[List[str], List[Union[int, str]]]: ...
def get_related_selections(
self,
select: List[Tuple[Expression, Optional[str]]],
opts: Optional[Options] = ...,
root_alias: Optional[str] = ...,
cur_depth: int = ...,
requested: Optional[
Union[Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]], bool]
] = ...,
restricted: Optional[bool] = ...,
) -> List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[
Dict[
str,
Union[
Callable,
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
ForeignKey,
],
]
],
List[int],
Type[Model],
bool,
FieldCacheMixin,
self,
order_by: List[Tuple[OrderBy, Tuple[str, List[Any], bool]]],
select: List[
Tuple[
Union[Expression, SQLiteNumericMixin],
Tuple[str, List[float]],
Optional[str],
]
],
]
]: ...
) -> List[Tuple[OrderBy, Tuple[str, List[Any]], None]]: ...
def quote_name_unless_alias(self, name: str) -> str: ...
def compile(
self, node: Any, select_format: Any = ...
) -> Tuple[str, Union[List[Optional[int]], Tuple[int, int]]]: ...
def get_combinator_sql(
self, combinator: str, all: bool
) -> Tuple[List[str], Union[List[int], List[str]]]: ...
def as_sql(
self, with_limits: bool = ..., with_col_aliases: bool = ...
) -> Any: ...
def get_default_columns(
self,
start_alias: Optional[str] = ...,
opts: Optional[Options] = ...,
from_parent: Optional[Type[Model]] = ...,
) -> List[Col]: ...
def get_distinct(self) -> Tuple[List[Any], List[Any]]: ...
def find_ordering_name(
self,
name: str,
opts: Options,
alias: Optional[str] = ...,
default_order: str = ...,
already_seen: Optional[
Set[Tuple[Optional[Tuple[Tuple[str, str]]], Tuple[Tuple[str, str]]]]
] = ...,
) -> List[Tuple[OrderBy, bool]]: ...
def get_from_clause(self) -> Tuple[List[str], List[Union[int, str]]]: ...
def get_related_selections(
self,
select: List[Tuple[Expression, Optional[str]]],
opts: Optional[Options] = ...,
root_alias: Optional[str] = ...,
cur_depth: int = ...,
requested: Optional[
Union[Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]], bool]
] = ...,
restricted: Optional[bool] = ...,
) -> List[Dict[str, Any]]: ...
def get_select_for_update_of_arguments(self): ...
def deferred_to_columns(self) -> Dict[Type[Model], Set[str]]: ...
def get_converters(
self, expressions: Union[List[RawSQL], List[SQLiteNumericMixin]]
self, expressions: Union[List[RawSQL], List[SQLiteNumericMixin]]
) -> Dict[
int, Tuple[List[Callable], Union[Expression, SQLiteNumericMixin]]
]: ...
def apply_converters(
self,
rows: chain,
converters: Dict[
int, Tuple[List[Callable], Union[Expression, SQLiteNumericMixin]]
],
self,
rows: chain,
converters: Dict[
int, Tuple[List[Callable], Union[Expression, SQLiteNumericMixin]]
],
) -> Iterator[
Union[
List[Optional[Union[bytes, datetime, int, str]]],
@@ -229,63 +173,82 @@ class SQLCompiler:
List[Optional[Union[datetime, float, str, UUID]]],
]
]: ...
def results_iter(
self,
results: Optional[
Union[Iterator[Any], List[List[Tuple[Union[int, str]]]]]
] = ...,
tuple_expected: bool = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...,
self,
results: Optional[
Union[Iterator[Any], List[List[Tuple[Union[int, str]]]]]
] = ...,
tuple_expected: bool = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...,
) -> Union[Iterator[Any], chain, map]: ...
def has_results(self) -> bool: ...
def execute_sql(
self,
result_type: str = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...,
self,
result_type: str = ...,
chunked_fetch: bool = ...,
chunk_size: int = ...,
) -> Optional[Union[Iterator[Any], CursorWrapper]]: ...
def as_subquery_condition(
self, alias: str, columns: List[str], compiler: SQLCompiler
self, alias: str, columns: List[str], compiler: SQLCompiler
) -> Tuple[str, Tuple]: ...
def explain_query(self) -> Iterator[str]: ...
class SQLInsertCompiler(SQLCompiler):
return_id: bool = ...
def field_as_sql(
self, field: Optional[Field], val: Optional[Union[Lower, float, str]]
self, field: Optional[Field], val: Optional[Union[Lower, float, str]]
) -> Tuple[str, Union[List[int], List[str]]]: ...
def prepare_value(
self, field: Field, value: Any
self, field: Field, value: Any
) -> Optional[Union[Lower, float, str]]: ...
def pre_save_val(self, field: Field, obj: Model) -> Any: ...
def assemble_as_sql(
self,
fields: Union[
List[None], List[DateTimeCheckMixin], List[Field], ImmutableList
],
value_rows: Union[
List[List[Optional[Union[Lower, int]]]], List[List[Union[int, str]]]
],
self,
fields: Union[
List[None], List[DateTimeCheckMixin], List[Field], ImmutableList
],
value_rows: Union[
List[List[Optional[Union[Lower, int]]]], List[List[Union[int, str]]]
],
) -> Tuple[Tuple[Tuple[str]], List[List[Optional[Union[int, str]]]]]: ...
def as_sql(self) -> List[Tuple[str, Tuple[Union[float, str]]]]: ...
def execute_sql(self, return_id: Optional[bool] = ...) -> Any: ...
class SQLDeleteCompiler(SQLCompiler):
def as_sql(self) -> Tuple[str, Tuple]: ...
class SQLUpdateCompiler(SQLCompiler):
def as_sql(self) -> Tuple[str, Tuple]: ...
def execute_sql(self, result_type: str) -> int: ...
def pre_sql_setup(self) -> None: ...
class SQLAggregateCompiler(SQLCompiler):
col_count: Any = ...
def as_sql(self) -> Tuple[str, Tuple]: ...
def cursor_iter(
cursor: CursorWrapper,
sentinel: List[Any],
col_count: Optional[int],
itersize: int,
cursor: CursorWrapper,
sentinel: List[Any],
col_count: Optional[int],
itersize: int,
) -> Iterator[List[Tuple[Union[date, int]]]]: ...