r"""Apply the given filtering criterion to a copy of this :class:`_query.Query`, using keyword expressions. e.g.:: session.query(MyClass).filter_by(name="some name") Multiple criteria may be specified as comma separated; the effect is that they will be
(self, **kwargs: Any)
| 1983 | return self._raw_columns[0] |
| 1984 | |
| 1985 | def filter_by(self, **kwargs: Any) -> Self: |
| 1986 | r"""Apply the given filtering criterion to a copy |
| 1987 | of this :class:`_query.Query`, using keyword expressions. |
| 1988 | |
| 1989 | e.g.:: |
| 1990 | |
| 1991 | session.query(MyClass).filter_by(name="some name") |
| 1992 | |
| 1993 | Multiple criteria may be specified as comma separated; the effect |
| 1994 | is that they will be joined together using the :func:`.and_` |
| 1995 | function:: |
| 1996 | |
| 1997 | session.query(MyClass).filter_by(name="some name", id=5) |
| 1998 | |
| 1999 | The keyword expressions are extracted from the primary |
| 2000 | entity of the query, or the last entity that was the |
| 2001 | target of a call to :meth:`_query.Query.join`. |
| 2002 | |
| 2003 | .. note:: |
| 2004 | |
| 2005 | :class:`_query.Query` is a legacy construct as of SQLAlchemy 2.0. |
| 2006 | See :meth:`_sql.Select.filter_by` for the comparable method on |
| 2007 | 2.0-style :func:`_sql.select` constructs, where the behavior has |
| 2008 | been enhanced in version 2.1 to search across all FROM clause |
| 2009 | entities. See :ref:`change_8601` for background. |
| 2010 | |
| 2011 | .. seealso:: |
| 2012 | |
| 2013 | :meth:`_query.Query.filter` - filter on SQL expressions. |
| 2014 | |
| 2015 | :meth:`_sql.Select.filter_by` - v2 comparable method. |
| 2016 | |
| 2017 | """ |
| 2018 | from_entity = self._filter_by_zero() |
| 2019 | |
| 2020 | clauses = [ |
| 2021 | _entity_namespace_key(from_entity, key) == value |
| 2022 | for key, value in kwargs.items() |
| 2023 | ] |
| 2024 | return self.filter(*clauses) |
| 2025 | |
| 2026 | @_generative |
| 2027 | def order_by( |