Re: [Django] #33698: QuerySet == operator is not implemented. (was: QuerySet == operator is not implemented)

2 views
Skip to first unread message

Django

unread,
May 12, 2022, 12:17:39 AM5/12/22
to django-...@googlegroups.com
#33698: QuerySet == operator is not implemented.
-------------------------------------+-------------------------------------
Reporter: Mohammad Ali | Owner: nobody
Mehdizadeh |
Type: New feature | Status: closed
Component: Database layer | Version: 4.0
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* type: Bug => New feature
* resolution: => wontfix


Comment:

Thanks for this ticket, however as far as I'm aware it's not feasible to
compare two queryset in a performant way (see also
[https://groups.google.com/g/django-developers/c/M_x4BbNta24/m/c5SZD-
uIAQAJ Adam's comment]). This should take into account all
[https://github.com/django/django/blob/34e2148fc725e7200050f74130d7523e3cd8507a/django/db/models/query.py#L291-L304
advanced options] (e.g. used expressions, prefetching, chosen fields,
etc.) and be preceded by an implementation of `==` operator for the
`Query` class which is even
[https://github.com/django/django/blob/34e2148fc725e7200050f74130d7523e3cd8507a/django/db/models/sql/query.py#L161-L228
more complicated]. Comparing the results is not an option because two
completely different queryset can return the same results.

IMO it's not worth the maintenance burden. You can always implement your
own hook if comparing results suits you.

--
Ticket URL: <https://code.djangoproject.com/ticket/33698#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Reply all
Reply to author
Forward
0 new messages