diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-09-12 19:18:08 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-09-12 19:18:08 -0400 |
| commit | fe250af8eb7294f08f491b3c1af9cf86a769f78c (patch) | |
| tree | 0f624b91fd80f3b47a4db47c79fc7188a349926a /lib/sqlalchemy/orm/collections.py | |
| parent | 109345550e9a7854aa69704ae13cc27d8364be08 (diff) | |
| download | sqlalchemy-fe250af8eb7294f08f491b3c1af9cf86a769f78c.tar.gz | |
- lazy loads for relationship attributes now use
the current state, not the "committed" state,
of foreign and primary key attributes
when issuing SQL, if a flush is not in process.
Previously, only the database-committed state would
be used. In particular, this would cause a many-to-one
get()-on-lazyload operation to fail, as autoflush
is not triggered on these loads when the attributes are
determined and the "committed" state may not be
available. [ticket:1910]
- A new flag on relationship(), load_on_pending, allows
the lazy loader to fire off on pending objects without a
flush taking place, as well as a transient object that's
been manually "attached" to the session. Note that this
flag blocks attribute events from taking place when an
object is loaded, so backrefs aren't available until
after a flush. The flag is only intended for very
specific use cases.
Diffstat (limited to 'lib/sqlalchemy/orm/collections.py')
| -rw-r--r-- | lib/sqlalchemy/orm/collections.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py index b80be970a..0789d9626 100644 --- a/lib/sqlalchemy/orm/collections.py +++ b/lib/sqlalchemy/orm/collections.py @@ -546,6 +546,7 @@ class CollectionAdapter(object): def append_with_event(self, item, initiator=None): """Add an entity to the collection, firing mutation events.""" + getattr(self._data(), '_sa_appender')(item, _sa_initiator=initiator) def append_without_event(self, item): |
