summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-07-18 11:41:12 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-07-18 15:04:36 -0400
commit7628ff39dcea080171f3f8bcbc7153c4c0119857 (patch)
treedbcd9b749c08dc440e70868a0ae8136f6f9fb158 /lib
parent32f67637cd705840751bd1d8d37db87df5823a4b (diff)
downloadsqlalchemy-7628ff39dcea080171f3f8bcbc7153c4c0119857.tar.gz
Check for column object in eval_none, not propkey
Fixed bug involving JSON NULL evaluation logic added in 1.1 as part of :ticket:`3514` where the logic would not accommodate ORM mapped attributes named differently from the :class:`.Column` that was mapped. Change-Id: I1848afcfb63ad7f074f315d8d3097666069b42be Fixes: #4031
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/mapper.py2
-rw-r--r--lib/sqlalchemy/orm/persistence.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index 1042442c0..6998a4c57 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -2020,7 +2020,7 @@ class Mapper(InspectionAttr):
(
table,
frozenset(
- col.key for col in columns
+ col for col in columns
if col.type.should_evaluate_none
)
)
diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py
index 924b9e1c9..faacd018e 100644
--- a/lib/sqlalchemy/orm/persistence.py
+++ b/lib/sqlalchemy/orm/persistence.py
@@ -398,7 +398,7 @@ def _collect_insert_commands(
for propkey in set(propkey_to_col).intersection(state_dict):
value = state_dict[propkey]
col = propkey_to_col[propkey]
- if value is None and propkey not in eval_none and not render_nulls:
+ if value is None and col not in eval_none and not render_nulls:
continue
elif not bulk and hasattr(value, '__clause_element__') or \
isinstance(value, sql.ClauseElement):