From 099522075088a3e1a333a2285c10a8a33b203c19 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 17 Apr 2019 13:37:39 -0400 Subject: Reimplement .compare() in terms of a visitor Reworked the :meth:`.ClauseElement.compare` methods in terms of a new visitor-based approach, and additionally added test coverage ensuring that all :class:`.ClauseElement` subclasses can be accurately compared against each other in terms of structure. Structural comparison capability is used to a small degree within the ORM currently, however it also may form the basis for new caching features. Fixes: #4336 Change-Id: I581b667d8e1642a6c27165cc9f4aded1c66effc6 --- lib/sqlalchemy/sql/selectable.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/sqlalchemy/sql/selectable.py') diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index d4528f0c3..796e2b272 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -1994,6 +1994,9 @@ class ForUpdateArg(ClauseElement): and other.of is self.of ) + def __ne__(self, other): + return not self.__eq__(other) + def __hash__(self): return id(self) @@ -3941,6 +3944,12 @@ class TextAsFrom(SelectBase): self._reset_exported() self.element = clone(self.element, **kw) + def get_children(self, column_collections=True, **kw): + if column_collections: + for c in self.column_args: + yield c + yield self.element + def _scalar_type(self): return self.column_args[0].type -- cgit v1.2.1