Skip to content

Conversation

@adamchainz
Copy link
Owner

Per https://docs.djangoproject.com/en/6.0/releases/6.0/\#custom-orm-expressions-should-return-params-as-a-tuple, ensure we always use a tuple for params, and the simpler unpacking syntax for combining them.

@adamchainz adamchainz requested a review from Copilot November 30, 2025 21:00
Copilot finished reviewing on behalf of adamchainz November 30, 2025 21:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors SQL parameter handling across custom ORM expressions to comply with Django 6.0 requirements, which mandate that as_sql methods return params as tuples rather than iterables. The changes introduce a simpler, more Pythonic unpacking syntax (*params1, *params2) to replace the verbose tuple(params1) + tuple(params2) pattern.

Key changes:

  • Updated as_sql methods to return params as tuples using unpacking syntax
  • Updated return type annotations from Iterable[Any] to tuple[Any, ...] where applicable
  • Removed unnecessary Iterable imports from modules where it's no longer used

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/testapp/test_dynamicfield.py Updated test's DumbTransform to return a tuple instead of a list for params
src/django_mysql/models/transforms.py Removed Iterable import and updated SetLength.as_sql return type annotation to tuple[Any, ...]
src/django_mysql/models/lookups.py Refactored SoundsLike, SetContains, and DynColHasKey to use tuple unpacking syntax for combining params
src/django_mysql/models/fields/lists.py Removed Iterable import, updated return type annotation, and refactored to use tuple unpacking in IndexLookup
src/django_mysql/models/fields/dynamic.py Simplified KeyTransform.as_sql to use tuple unpacking syntax
src/django_mysql/models/expressions.py Refactored multiple expression classes (AppendListF, PopListF, PopLeftListF, AddSetF, RemoveSetF) to use tuple unpacking syntax

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Per https://docs.djangoproject.com/en/6.0/releases/6.0/\#custom-orm-expressions-should-return-params-as-a-tuple, ensure we always use a tuple for params, and the simpler unpacking syntax for combining them.
@adamchainz adamchainz merged commit 531dca6 into main Nov 30, 2025
39 checks passed
@adamchainz adamchainz deleted the tuple_params branch November 30, 2025 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants