]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- small updates to polymorphic eager loading, cross-link from
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 11 Aug 2016 15:45:03 +0000 (11:45 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 11 Aug 2016 15:45:49 +0000 (11:45 -0400)
loading documentation

Change-Id: I3ce7e2cc521c4dd155195819a919017d4cc63b3c
(cherry picked from commit 09cf0376524dc0bac6c1ab05d3c43cdd29c362b1)

doc/build/orm/inheritance.rst
doc/build/orm/loading_relationships.rst
lib/sqlalchemy/orm/util.py

index f640973c4a952edc3e6a6b417e716ab44a30e32d..fb4de7df3be92e9db761bbae977facb2dc329753 100644 (file)
@@ -500,7 +500,7 @@ can be loaded::
 
     manager_and_engineer = with_polymorphic(
                                 Employee, [Manager, Engineer],
-                                aliased=True)
+                                flat=True)
 
     session.query(Company).\
         options(
@@ -508,13 +508,6 @@ can be loaded::
             )
         )
 
-.. versionadded:: 0.8
-    :func:`.joinedload`, :func:`.subqueryload`, :func:`.contains_eager`
-    and related loader options support
-    paths that are qualified with
-    :func:`~sqlalchemy.orm.interfaces.PropComparator.of_type`, supporting
-    single target types as well as :func:`.orm.with_polymorphic` targets.
-
 Another option for the above query is to state the two subtypes separately;
 the :func:`.joinedload` directive should detect this and create the
 above ``with_polymorphic`` construct automatically::
index 3a0026bbe52526641247727095bf71244aadd4b8..00e8c735c2732b202ca15d2011c308cb7f40e8bd 100644 (file)
@@ -178,6 +178,14 @@ of a particular attribute, the :func:`.defaultload` method/function may be used:
     as well as the ``_all()`` functions will remain available for backwards-
     compatibility indefinitely.
 
+Polymorphic Eager Loading
+-------------------------
+
+Specification of polymorpic options on a per-eager-load basis is supported.
+See the section :ref:`eagerloading_polymorphic_subtypes` for examples
+of the :meth:`.PropComparator.of_type` method in conjunction with the 
+:func:`.orm.with_polymorphic` function.
+
 Default Loading Strategies
 --------------------------
 
index 42fadcaa6c86ed67ef6d42e543a61266c1e34f15..9ea25546e6cb7d5c85b033169a3c226722e5d8a5 100644 (file)
@@ -692,11 +692,11 @@ def with_polymorphic(base, classes, selectable=False,
         versions of MySQL.
 
     :param flat: Boolean, will be passed through to the
-        :meth:`.FromClause.alias` call so that aliases of :class:`.Join`
-        objects don't include an enclosing SELECT.  This can lead to more
-        efficient queries in many circumstances.  A JOIN against a nested JOIN
-        will be rewritten as a JOIN against an aliased SELECT subquery on
-        backends that don't support this syntax.
+     :meth:`.FromClause.alias` call so that aliases of :class:`.Join`
+     objects don't include an enclosing SELECT.  This can lead to more
+     efficient queries in many circumstances.  A JOIN against a nested JOIN
+     will be rewritten as a JOIN against an aliased SELECT subquery on
+     backends that don't support this syntax.
 
      Setting ``flat`` to ``True`` implies the ``aliased`` flag is
      also ``True``.