diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-04-29 14:00:16 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-04-29 14:00:16 -0400 |
| commit | b0be9211c9a2d9032b659b63888ffc76f64d4247 (patch) | |
| tree | 96b55f9441f1e30d0643cee89e7518bd8a87031d /lib/sqlalchemy/orm | |
| parent | 93b5eae9843d423378f68be928a4f1e6fcacfb87 (diff) | |
| download | sqlalchemy-b0be9211c9a2d9032b659b63888ffc76f64d4247.tar.gz | |
- Fixed regression within the flush process when an attribute were
set to a SQL expression for an UPDATE, and the SQL expression when
compared to the previous value of the attribute would produce a SQL
comparison other than ``==`` or ``!=``, the exception "Boolean value
of this clause is not defined" would raise. The fix ensures that
the unit of work will not interpret the SQL expression in this way.
fixes #3402
Diffstat (limited to 'lib/sqlalchemy/orm')
| -rw-r--r-- | lib/sqlalchemy/orm/persistence.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py index 34c37dab6..c3974ed6d 100644 --- a/lib/sqlalchemy/orm/persistence.py +++ b/lib/sqlalchemy/orm/persistence.py @@ -452,12 +452,11 @@ def _collect_update_commands( value = state_dict[propkey] col = propkey_to_col[propkey] - if not state.manager[propkey].impl.is_equal( + if isinstance(value, sql.ClauseElement): + value_params[col] = value + elif not state.manager[propkey].impl.is_equal( value, state.committed_state[propkey]): - if isinstance(value, sql.ClauseElement): - value_params[col] = value - else: - params[col.key] = value + params[col.key] = value if update_version_id is not None and \ mapper.version_id_col in mapper._cols_by_table[table]: |
