]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add an additional note regarding select_from, fixes #3546
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 2 Oct 2015 15:23:50 +0000 (11:23 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 2 Oct 2015 15:24:23 +0000 (11:24 -0400)
(cherry picked from commit d84dea62de3a9c83ad539a5cf2ff4be2c0685a94)

doc/build/orm/tutorial.rst

index dc077b17785a26c4c7a46146e2d9f4790221bd9c..31579ef3bab7f1fcde4237ba10ce8127c5ad2d74 100644 (file)
@@ -1322,6 +1322,16 @@ The reference documentation for :meth:`~.Query.join` contains detailed informati
 and examples of the calling styles accepted by this method; :meth:`~.Query.join`
 is an important method at the center of usage for any SQL-fluent application.
 
+.. topic:: What does :class:`.Query` select from if there's multiple entities?
+
+    The :meth:`.Query.join` method will **typically join from the leftmost
+    item** in the list of entities, when the ON clause is omitted, or if the
+    ON clause is a plain SQL expression.  To control the first entity in the list
+    of JOINs, use the :meth:`.Query.select_from` method::
+
+        query = Session.query(User, Address).select_from(Address).join(User)
+
+
 .. _ormtutorial_aliases:
 
 Using Aliases