summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/attributes.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-03-22 12:56:23 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-03-22 17:44:56 -0400
commit1fcbc17b7dd5a5cad71ee79441aa3293c00b8877 (patch)
treec87cb20c6fd7a9b6220b1cb3f27faac7d6d03261 /lib/sqlalchemy/orm/attributes.py
parent28edc2604a96d5ecd8318232c95a034433aa07d1 (diff)
downloadsqlalchemy-1fcbc17b7dd5a5cad71ee79441aa3293c00b8877.tar.gz
Support hybrids/composites with bulk updates
The :meth:`.Query.update` method can now accommodate both hybrid attributes as well as composite attributes as a source of the key to be placed in the SET clause. For hybrids, an additional decorator :meth:`.hybrid_property.update_expression` is supplied for which the user supplies a tuple-returning function. Change-Id: I15e97b02381d553f30b3301308155e19128d2cfb Fixes: #3229
Diffstat (limited to 'lib/sqlalchemy/orm/attributes.py')
-rw-r--r--lib/sqlalchemy/orm/attributes.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index a387e7d76..23a9f1a8c 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -151,6 +151,11 @@ class QueryableAttribute(interfaces._MappedAttribute,
return self.comparator._query_clause_element()
+ def _bulk_update_tuples(self, value):
+ """Return setter tuples for a bulk UPDATE."""
+
+ return self.comparator._bulk_update_tuples(value)
+
def adapt_to_entity(self, adapt_to_entity):
assert not self._of_type
return self.__class__(adapt_to_entity.entity,