# or call filter()/filter_by() multiple times
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_
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'))
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)
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.
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)