]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- remove ambiguous use of the phrase "joined together by AND" as this
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 1 Oct 2015 13:37:53 +0000 (09:37 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 1 Oct 2015 13:39:16 +0000 (09:39 -0400)
may be construed as the Python "and" keyword
- add notes to ORM tutorial for beginners that Python "and" keyword
is not to be used
fixes #3545

(cherry picked from commit ac08920284935e7e7519ce77ba369703390155dc)

doc/build/orm/tutorial.rst
lib/sqlalchemy/orm/query.py

index 7d40124c95a889321ee2192a28da87c8791605cd..dc077b17785a26c4c7a46146e2d9f4790221bd9c 100644 (file)
@@ -795,11 +795,17 @@ Here's a rundown of some of the most common operators used in
     # or chain multiple filter()/filter_by() calls
     query.filter(User.name == 'ed').filter(User.fullname == 'Ed Jones')
 
+ .. note::  Make sure you use :func:`.and_` and **not** the
+    Python ``and`` operator!
+
 * :func:`OR <.sql.expression.or_>`::
 
     from sqlalchemy import or_
     query.filter(or_(User.name == 'ed', User.name == 'wendy'))
 
+ .. note::  Make sure you use :func:`.or_` and **not** the
+    Python ``or`` operator!
+
 * :meth:`MATCH <.ColumnOperators.match>`::
 
     query.filter(User.name.match('wendy'))
index 2822d2b3417d0457622d7937a29d6e5a7f0a08c9..3ebfe702ce9c97d1687d8f923f62522982db1a1f 100644 (file)
@@ -1236,7 +1236,9 @@ class Query(object):
 
             session.query(MyClass).filter(MyClass.name == 'some name')
 
-        Multiple criteria are joined together by AND::
+        Multiple criteria may be specified as comma separated; the effect
+        is that they will be joined together using the :func:`.and_`
+        function::
 
             session.query(MyClass).\\
                 filter(MyClass.name == 'some name', MyClass.id > 5)
@@ -1245,9 +1247,6 @@ class Query(object):
         WHERE clause of a select.   String expressions are coerced
         into SQL expression constructs via the :func:`.text` construct.
 
-        .. versionchanged:: 0.7.5
-            Multiple criteria joined by AND.
-
         .. seealso::
 
             :meth:`.Query.filter_by` - filter on keyword expressions.
@@ -1271,7 +1270,9 @@ class Query(object):
 
             session.query(MyClass).filter_by(name = 'some name')
 
-        Multiple criteria are joined together by AND::
+        Multiple criteria may be specified as comma separated; the effect
+        is that they will be joined together using the :func:`.and_`
+        function::
 
             session.query(MyClass).\\
                 filter_by(name = 'some name', id = 5)