summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/crud.py
diff options
context:
space:
mode:
authorGorka Eguileor <geguileo@redhat.com>2015-09-30 18:45:05 +0200
committerGorka Eguileor <geguileo@redhat.com>2015-09-30 18:45:05 +0200
commitddb43cebf68b9e6194a1a22b7630e143d2a79c00 (patch)
treeccaca42d05eeed19288a33bd7eceb6c4e5db2d49 /lib/sqlalchemy/sql/crud.py
parent9fb76d759678558f6fd087dcc04de3f2daa3a571 (diff)
downloadsqlalchemy-ddb43cebf68b9e6194a1a22b7630e143d2a79c00.tar.gz
Postpone parameters change in ordered updates
Postpone as much as possible the change of update parameters to OrderedDict from list or tuple of pairs. This way we won't have problems with query's update method.
Diffstat (limited to 'lib/sqlalchemy/sql/crud.py')
-rw-r--r--lib/sqlalchemy/sql/crud.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/crud.py b/lib/sqlalchemy/sql/crud.py
index 235889ad9..0ab52a13e 100644
--- a/lib/sqlalchemy/sql/crud.py
+++ b/lib/sqlalchemy/sql/crud.py
@@ -68,8 +68,13 @@ def _get_crud_params(compiler, stmt, **kw):
# without isupdate check, but adding it shortcircuits the boolean operation
# resulting in false for all inserts.
keep_order = (compiler.isupdate
- and sql_util.is_value_pair_dict(stmt.parameters))
- dict_type = util.OrderedDict if keep_order else dict
+ and sql_util.is_value_pair_dict(stmt_parameters))
+ if keep_order:
+ stmt_parameters = util.OrderedDict(stmt_parameters)
+ dict_type = util.OrderedDict
+ else:
+ dict_type = dict
+
# if we have statement parameters - set defaults in the
# compiled params
if compiler.column_keys is None: