]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
- lazy loads for relationship attributes now use
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 12 Sep 2010 23:18:08 +0000 (19:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 12 Sep 2010 23:18:08 +0000 (19:18 -0400)
commitfe250af8eb7294f08f491b3c1af9cf86a769f78c
tree0f624b91fd80f3b47a4db47c79fc7188a349926a
parent109345550e9a7854aa69704ae13cc27d8364be08
- 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.
13 files changed:
CHANGES
doc/build/testdocs.py
lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/attributes.py
lib/sqlalchemy/orm/collections.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/orm/state.py
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/orm/util.py
lib/sqlalchemy/sql/util.py
test/orm/test_load_on_fks.py [new file with mode: 0644]
test/zblog/test_zblog.py