Skip to content

Commit 3fda62f

Browse files
committed
Fix types for IndexLookup.as_sql()
1 parent 8e26ce2 commit 3fda62f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/django_mysql/models/fields/lists.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from __future__ import annotations
22

3-
from typing import Any, Callable, Iterable, cast
3+
from typing import Any, Callable, cast
44

55
from django.core import checks
66
from django.db.backends.base.base import BaseDatabaseWrapper
77
from django.db.models import CharField, Field, IntegerField, Lookup, Model, TextField
88
from django.db.models.expressions import BaseExpression
9+
from django.db.models.sql.compiler import SQLCompiler
910
from django.forms import Field as FormField
1011
from django.utils.translation import gettext_lazy as _
1112

@@ -221,10 +222,10 @@ def __init__(self, index: int, *args: Any, **kwargs: Any) -> None:
221222
self.index = index
222223

223224
def as_sql(
224-
self, qn: Callable[[str], str], connection: BaseDatabaseWrapper
225-
) -> tuple[str, Iterable[Any]]:
226-
lhs, lhs_params = self.process_lhs(qn, connection)
227-
rhs, rhs_params = self.process_rhs(qn, connection)
225+
self, compiler: SQLCompiler, connection: BaseDatabaseWrapper
226+
) -> tuple[str, list[str | int]]:
227+
lhs, lhs_params = self.process_lhs(compiler, connection)
228+
rhs, rhs_params = self.process_rhs(compiler, connection)
228229
params = tuple(lhs_params) + tuple(rhs_params)
229230
# Put rhs on the left since that's the order FIND_IN_SET uses
230231
return f"(FIND_IN_SET({rhs}, {lhs}) = {self.index})", params

0 commit comments

Comments
 (0)