summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/session.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-03-02 10:45:42 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2018-03-02 10:47:15 -0500
commita833c9f7012cb8dd31001443eb745819f5e6dcf8 (patch)
tree3979271f45d7f55826540a655900128960a7ea82 /lib/sqlalchemy/orm/session.py
parente3323df4bd781a593e90c1cb4a187ff37cc04e5a (diff)
downloadsqlalchemy-a833c9f7012cb8dd31001443eb745819f5e6dcf8.tar.gz
Fix enable_relationship_loading() works fine w/ one-to-many
Change-Id: I6efb62afa02be4d42482cfdbec739a5c6ab32bd7
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
-rw-r--r--lib/sqlalchemy/orm/session.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py
index 5a27140ac..13f78317c 100644
--- a/lib/sqlalchemy/orm/session.py
+++ b/lib/sqlalchemy/orm/session.py
@@ -2112,9 +2112,9 @@ class Session(_SessionClassMethods):
Accesses of attributes mapped with :func:`.relationship`
will attempt to load a value from the database using this
:class:`.Session` as the source of connectivity. The values
- will be loaded based on foreign key values present on this
- object - it follows that this functionality
- generally only works for many-to-one-relationships.
+ will be loaded based on foreign key and primary key values
+ present on this object - if not present, then those relationships
+ will be unavailable.
The object will be attached to this session, but will
**not** participate in any persistence operations; its state
@@ -2135,6 +2135,8 @@ class Session(_SessionClassMethods):
To make a transient object associated with a :class:`.Session`
via :meth:`.Session.enable_relationship_loading` pending, add
it to the :class:`.Session` using :meth:`.Session.add` normally.
+ If the object instead represents an existing idenity in the database,
+ it should be merged using :meth:`.Session.merge`.
:meth:`.Session.enable_relationship_loading` does not improve
behavior when the ORM is used normally - object references should be