]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add a note clarifying query.with_labels(), fixes #3506
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 3 Aug 2015 21:46:34 +0000 (17:46 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 3 Aug 2015 21:47:07 +0000 (17:47 -0400)
(cherry picked from commit 292f5bec1cbfcaa9d16af8fe4149c7191f194f11)

lib/sqlalchemy/orm/query.py

index fd8f9d53b461e35f8c379399a02c63af03efde01..154e9d1185d71941c7fc5441f8ec57c3bf7c9f25 100644 (file)
@@ -597,6 +597,16 @@ class Query(object):
         When the `Query` actually issues SQL to load rows, it always
         uses column labeling.
 
+        .. note:: The :meth:`.Query.with_labels` method *only* applies
+           the output of :attr:`.Query.statement`, and *not* to any of
+           the result-row invoking systems of :class:`.Query` itself, e.g.
+           :meth:`.Query.first`, :meth:`.Query.all`, etc.   To execute
+           a query using :meth:`.Query.with_labels`, invoke the
+           :attr:`.Query.statement` using :meth:`.Session.execute`::
+
+                result = session.execute(query.with_labels().statement)
+
+
         """
         self._with_labels = True