From 1fcbc17b7dd5a5cad71ee79441aa3293c00b8877 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 22 Mar 2017 12:56:23 -0400 Subject: 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 --- lib/sqlalchemy/testing/assertions.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/sqlalchemy/testing/assertions.py') diff --git a/lib/sqlalchemy/testing/assertions.py b/lib/sqlalchemy/testing/assertions.py index c8525f2f6..0244f18a9 100644 --- a/lib/sqlalchemy/testing/assertions.py +++ b/lib/sqlalchemy/testing/assertions.py @@ -330,6 +330,10 @@ class AssertsCompiledSQL(object): context = clause._compile_context() context.statement.use_labels = True clause = context.statement + elif isinstance(clause, orm.persistence.BulkUD): + with mock.patch.object(clause, "_execute_stmt") as stmt_mock: + clause.exec_() + clause = stmt_mock.mock_calls[0][1][0] if compile_kwargs: kw['compile_kwargs'] = compile_kwargs -- cgit v1.2.1