diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-02-22 23:53:35 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-02-22 23:53:35 +0000 |
commit | 9f020d3ba342cb777d20f7eed0304e8806d47207 (patch) | |
tree | a64116e5b5524b9ed180761a388776d42e2b1693 /lib/sqlalchemy/orm/session.py | |
parent | e3ffcf82ce1f0ba4bf887f889d7f1c0bfcc1f68b (diff) | |
download | sqlalchemy-9f020d3ba342cb777d20f7eed0304e8806d47207.tar.gz |
- The "allow_null_pks" flag is now called "allow_partial_pks",
defaults to True, acts like it did in 0.5 again. Except,
it also is implemented within merge() such that a SELECT
won't be issued for an incoming instance with partially
NULL primary key if the flag is False. [ticket:1680]
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
-rw-r--r-- | lib/sqlalchemy/orm/session.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index c7a5a361b..0543cd38d 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -1153,8 +1153,10 @@ class Session(object): merged_state.key = key self._update_impl(merged_state) new_instance = True - - elif not _none_set.issuperset(key[1]): + + elif not _none_set.issubset(key[1]) or \ + (mapper.allow_partial_pks and + not _none_set.issuperset(key[1])): merged = self.query(mapper.class_).get(key[1]) else: merged = None |