[Sqlalchemy-tickets] Issue #3017: relationship loading strategy `expired` (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
|
From: Ronny P. <iss...@bi...> - 2014-04-09 14:58:11
|
New issue 3017: relationship loading strategy `expired` https://bitbucket.org/zzzeek/sqlalchemy/issue/3017/relationship-loading-strategy-expired Ronny Pfannschmidt: currently all relationship loading loads the object on access to use such objects without hitting the database, i propose a loading strategy which returns an expired instance with only the identity key set roguhly the equivalent of ``` def hull(session, class_, *pk): mapper = class_mapper(class_) obj = class_() inspect(obj).key = mapper.identity_key_from_primary_key(pk) session.add(obj) session.expire(obj) return obj ``` |