From aed2324b4de3c4f3e6cc7f801fc8ddd8e2d9012b Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 13 Sep 2017 11:39:47 -0400 Subject: Add multivalued insert context for defaults Added a new method :class:`.DefaultExecutionContext.current_parameters` which is used within a function-based default value generator in order to retrieve the current parameters being passed to the statement. The new function differs from the ``.current_parameters`` attribute in that it also provides for optional grouping of parameters that correspond to a multi-valued "insert" construct. Previously it was not possible to identify the subset of parameters that were relevant to the function call. Change-Id: I6894c7b4a2bce3e83c3ade8af0e5b2f8df37b785 Fixes: #4075 --- lib/sqlalchemy/sql/crud.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/sqlalchemy/sql/crud.py') diff --git a/lib/sqlalchemy/sql/crud.py b/lib/sqlalchemy/sql/crud.py index 5739c22f9..8421b1e66 100644 --- a/lib/sqlalchemy/sql/crud.py +++ b/lib/sqlalchemy/sql/crud.py @@ -395,7 +395,10 @@ def _create_update_prefetch_bind_param(compiler, c, process=True, name=None): class _multiparam_column(elements.ColumnElement): + _is_multiparam_column = True + def __init__(self, original, index): + self.index = index self.key = "%s_m%d" % (original.key, index + 1) self.original = original self.default = original.default -- cgit v1.2.1