diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-01-31 19:57:38 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-01-31 19:57:38 -0500 |
commit | 33c7cfff6eb1b8d93dee3b4a76f4cac38c772d77 (patch) | |
tree | 9db95f480f5d7f1db1322c855f907bef6bf73e0e /lib/sqlalchemy/orm/attributes.py | |
parent | 6b3ecd14eae1a557cffd19da6c82d967586a6d74 (diff) | |
download | sqlalchemy-33c7cfff6eb1b8d93dee3b4a76f4cac38c772d77.tar.gz |
- Added a new directive used within the scope of an attribute "set" operation
to disable autoflush, in the case that the attribute needs to lazy-load
the "old" value, as in when replacing one-to-one values or some
kinds of many-to-one. A flush at this point otherwise occurs
at the point that the attribute is None and can cause NULL violations.
[ticket:2921]
Diffstat (limited to 'lib/sqlalchemy/orm/attributes.py')
-rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index e5f8550ab..7647bf9d0 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -23,7 +23,7 @@ from .base import PASSIVE_NO_RESULT, ATTR_WAS_SET, ATTR_EMPTY, NO_VALUE,\ NEVER_SET, NO_CHANGE, CALLABLES_OK, SQL_OK, RELATED_OBJECT_OK,\ INIT_OK, NON_PERSISTENT_OK, LOAD_AGAINST_COMMITTED, PASSIVE_OFF,\ PASSIVE_RETURN_NEVER_SET, PASSIVE_NO_INITIALIZE, PASSIVE_NO_FETCH,\ - PASSIVE_NO_FETCH_RELATED, PASSIVE_ONLY_PERSISTENT + PASSIVE_NO_FETCH_RELATED, PASSIVE_ONLY_PERSISTENT, NO_AUTOFLUSH from .base import state_str, instance_str @inspection._self_inspects @@ -761,7 +761,7 @@ class ScalarObjectAttributeImpl(ScalarAttributeImpl): """ if self.dispatch._active_history: - old = self.get(state, dict_, passive=PASSIVE_ONLY_PERSISTENT) + old = self.get(state, dict_, passive=PASSIVE_ONLY_PERSISTENT | NO_AUTOFLUSH) else: old = self.get(state, dict_, passive=PASSIVE_NO_FETCH) |