Changes between Initial Version and Version 1 of Ticket #32632, comment 4


Ignore:
Timestamp:
Apr 14, 2021, 9:50:02 PM (4 years ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32632, comment 4

    initial v1  
    33Before bbf141bcdc31f1324048af9233583a523ac54c94 `Query.__eq__` was wrongly returning `True` due to making it a subclass `BaseExpression` in 35431298226165986ad07e91f9d3aca721ff38ec. Before these changes `Query.__eq__` was not implemented which meant that `Model.objects.filter(foo=bar).query != Model.objects.filter(foo=bar).query` as `object.__eq__` is based of `id(self) == id(other)`. This is problematic for expressions such as `Exists` and `Subquery` which are based off `sql.Query` and need to be able to compare to each other to implement the ''expression'' API.
    44
    5 Since `sql.Query` is an immutable internal object we could possibly `cached_property(identity)` and move along as that cuts the slowdown in about half, that does feel like a bandaid solution though. It's interesting to me that `Node.add` would compare all its children in the first place as that seems like a costly operation but I do wonder if
     5Since `sql.Query` is an immutable internal object we could possibly `cached_property(identity)` and move along as that cuts the slowdown in about half, that does feel like a bandaid solution though. It's interesting to me that `Node.add` would compare all its children in the first place as that seems like a costly operation with little benefit in the first place.
    66
    77After playing around with a few things here's a list of two proposed solutions
Back to Top