summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-05-15 09:39:19 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-05-24 16:23:56 -0400
commitde11c5217b4c62f86dfd05a28689159095ab1024 (patch)
tree0b1521f3f770f47ea209c4a45ab51a7f225e2fca /lib/sqlalchemy/sql
parent9a37503bbedcb958e515ea91c2322efb96bf2680 (diff)
downloadsqlalchemy-de11c5217b4c62f86dfd05a28689159095ab1024.tar.gz
Add with_for_update() support in session.refresh()
Session.refresh() is still hardcoded to legacy lockmode, come up with a new API so that the newer argument style works with it. Added new argument :paramref:`.with_for_update` to the :meth:`.Session.refresh` method. When the :meth:`.Query.with_lockmode` method were deprecated in favor of :meth:`.Query.with_for_update`, the :meth:`.Session.refresh` method was never updated to reflect the new option. Change-Id: Ia02a653746b7024699b515451525a88d7a17d63a Fixes: #3991
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/selectable.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py
index a6ed6b0ce..a1e3abcb4 100644
--- a/lib/sqlalchemy/sql/selectable.py
+++ b/lib/sqlalchemy/sql/selectable.py
@@ -1841,6 +1841,19 @@ class ForUpdateArg(ClauseElement):
else:
return True
+ def __eq__(self, other):
+ return (
+ isinstance(other, ForUpdateArg) and
+ other.nowait == self.nowait and
+ other.read == self.read and
+ other.skip_locked == self.skip_locked and
+ other.key_share == self.key_share and
+ other.of is self.of
+ )
+
+ def __hash__(self):
+ return id(self)
+
def _copy_internals(self, clone=_clone, **kw):
if self.of is not None:
self.of = [clone(col, **kw) for col in self.of]