#22349: RawQuerySet doesn't implement __len__, __bool__
-------------------------------------+-------------------------------------
Reporter: cdestigter | Owner:
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by akaariai):
We discussed this with Loic on IRC. Introducing `__len__` and friends
without caching the results is a bad idea. One possibility considered was
adding caching to RawQuerySet so that it works like QuerySet, and also add
.iterator() method to RawQuerySet so that when iterating over large
queryset one can avoid the performance and memory penalty of caching.
There doesn't seem to be a way to introduce this change using deprecation
path or check framework, so we would need to just do the change and warn
about the change in release notes. As the current behavior doesn't seem to
be a big pain point for users, and some users could be relying on current
behavior, I think it is better to leave things as they are. However, we
should add some documentation about the evaluation time differences
between qs and rawqs, so I'll leave this ticket open for that.
--
Ticket URL: <https://code.djangoproject.com/ticket/22349#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.108a9fab3b9bcdb384fb57258cfb1aca%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.