diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-05-13 15:45:56 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-05-13 15:45:56 -0400 |
| commit | f0fa460791735cd27dc41b1ed154465ea2441be5 (patch) | |
| tree | 107d344781c4581c1945efcb212fa44559425125 /lib/sqlalchemy | |
| parent | e352e255a749b6e75e18bd41bf6646eeea345442 (diff) | |
| download | sqlalchemy-f0fa460791735cd27dc41b1ed154465ea2441be5.tar.gz | |
- Added internal warning in case an instance without a
full PK happened to be expired and then was asked
to refresh. [ticket:1797]
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index aec7794f3..a0f234057 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -2095,6 +2095,15 @@ def _load_scalar_attributes(state, attribute_names): else: identity_key = mapper._identity_key_from_state(state) + if (_none_set.issubset(identity_key) and \ + not mapper.allow_partial_pks) or \ + _none_set.issuperset(identity_key): + util.warn("Instance %s to be refreshed doesn't " + "contain a full primary key - can't be refreshed " + "(and shouldn't be expired, either)." + % state_str(state)) + return + result = session.query(mapper)._get( identity_key, refresh_state=state, |
