summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-08-20 18:28:32 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-08-20 18:28:32 -0400
commit0c101f764d5ba0e86fa35cc2f8cea0f13e8fbc90 (patch)
tree4ce9294b81cf84caee510679aa452d757a45d937 /lib/sqlalchemy/sql
parent2ccd77e5dc6e389159a64f7aed39b9785580a01c (diff)
downloadsqlalchemy-0c101f764d5ba0e86fa35cc2f8cea0f13e8fbc90.tar.gz
- MySQL's update does work. add some logic to compiler to convert from ORM column to Table column
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/compiler.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index c56b7fc37..fd9718f1f 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1446,14 +1446,18 @@ class SQLCompiler(engine.Compiled):
# special logic that only occurs for multi-table UPDATE
# statements
if extra_tables and stmt.parameters:
+ normalized_params = dict(
+ (sql._clause_element_as_expr(c), param)
+ for c, param in stmt.parameters.items()
+ )
assert self.isupdate
affected_tables = set()
for t in extra_tables:
for c in t.c:
- if c in stmt.parameters:
+ if c in normalized_params:
affected_tables.add(t)
check_columns[c.key] = c
- value = stmt.parameters[c]
+ value = normalized_params[c]
if sql._is_literal(value):
value = self._create_crud_bind_param(
c, value, required=value is required)
@@ -1466,7 +1470,7 @@ class SQLCompiler(engine.Compiled):
# server_onupdate for these
for t in affected_tables:
for c in t.c:
- if c in stmt.parameters:
+ if c in normalized_params:
continue
elif c.onupdate is not None and not c.onupdate.is_sequence:
if c.onupdate.is_clause_element: