Skip to content

Commit c5316de

Browse files
authored
Update django.db.models.sql for Django 5.2 (#2606)
Signed-off-by: SaJH <wogur981208@gmail.com>
1 parent 95f824a commit c5316de

File tree

4 files changed

+5
-21
lines changed

4 files changed

+5
-21
lines changed

django-stubs/db/models/sql/constants.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ GET_ITERATOR_CHUNK_SIZE: Final[int]
44

55
MULTI: Literal["multi"]
66
SINGLE: Literal["single"]
7-
CURSOR: Literal["cursor"]
87
NO_RESULTS: Literal["no results"]
8+
CURSOR: Literal["cursor"]
9+
ROW_COUNT: Literal["row count"]
910

1011
ORDER_DIR: dict[str, tuple[str, str]]
1112

django-stubs/db/models/sql/query.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class Query(BaseExpression):
6666
max_depth: int
6767
join_class: type[Join]
6868
values_select: tuple
69+
selected: dict[str, int | str | Expression] | None
6970
annotation_select_mask: list[str] | None
7071
combinator: str | None
7172
combinator_all: bool
@@ -148,7 +149,7 @@ class Query(BaseExpression):
148149
) -> tuple[WhereNode, Iterable[str]]: ...
149150
def add_select_col(self, col: Any, name: str) -> None: ...
150151
def add_filter(self, filter_lhs: tuple[str, Any], filter_rhs: tuple[str, Any]) -> None: ...
151-
def add_q(self, q_object: Q) -> None: ...
152+
def add_q(self, q_object: Q, reuse_all: bool = False) -> None: ...
152153
def build_where(self, filter_expr: Q | Expression | dict[str, str] | tuple[str, Any]) -> WhereNode: ...
153154
def add_filtered_relation(self, filtered_relation: FilteredRelation, alias: str) -> None: ...
154155
def setup_joins(
@@ -214,7 +215,7 @@ class Query(BaseExpression):
214215
def is_nullable(self, field: Field) -> bool: ...
215216
def check_filterable(self, expression: Any) -> None: ...
216217
def build_lookup(self, lookups: Sequence[str], lhs: Expression | Query, rhs: Any) -> Lookup: ...
217-
def try_transform(self, lhs: Expression | Query, name: str) -> Transform: ...
218+
def try_transform(self, lhs: Expression | Query, name: str, lookups: Sequence[str] | None = ...) -> Transform: ...
218219
def join(
219220
self,
220221
join: BaseTable | Join,

django-stubs/db/models/sql/where.pyi

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ from django.db.backends.base.base import BaseDatabaseWrapper
55
from django.db.models.expressions import Expression
66
from django.db.models.fields import BooleanField
77
from django.db.models.sql.compiler import SQLCompiler, _AsSqlType, _ParamsT
8-
from django.db.models.sql.query import Query
98
from django.utils import tree
109
from django.utils.functional import cached_property
1110

@@ -50,12 +49,3 @@ class ExtraWhere:
5049
def as_sql(
5150
self, compiler: SQLCompiler | None = None, connection: BaseDatabaseWrapper | None = None
5251
) -> _AsSqlType: ...
53-
54-
class SubqueryConstraint:
55-
contains_aggregate: bool
56-
alias: str
57-
columns: list[str]
58-
targets: list[str]
59-
query_object: Query
60-
def __init__(self, alias: str, columns: list[str], targets: list[str], query_object: Query) -> None: ...
61-
def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ...

scripts/stubtest/allowlist_todo_django52.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,10 @@ django.db.models.functions.comparison.JSONObject
191191
django.db.models.functions.json
192192
django.db.models.options.Options.is_composite_pk
193193
django.db.models.options.Options.pk_fields
194-
django.db.models.sql.Query.add_q
195-
django.db.models.sql.Query.selected
196-
django.db.models.sql.Query.try_transform
197194
django.db.models.sql.compiler.SQLCompiler.as_subquery_condition
198195
django.db.models.sql.compiler.SQLCompiler.composite_fields_to_tuples
199196
django.db.models.sql.compiler.SQLCompiler.has_composite_fields
200197
django.db.models.sql.compiler.SQLInsertCompiler.field_as_sql
201-
django.db.models.sql.constants.ROW_COUNT
202-
django.db.models.sql.query.Query.add_q
203-
django.db.models.sql.query.Query.selected
204-
django.db.models.sql.query.Query.try_transform
205-
django.db.models.sql.where.SubqueryConstraint
206198
django.forms.BaseForm.bound_field_class
207199
django.forms.BoundField.aria_describedby
208200
django.forms.Field.__init__

0 commit comments

Comments
 (0)