]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Don't use and_() inside of Query.filter_by
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 10 Apr 2019 15:51:27 +0000 (11:51 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 10 Apr 2019 15:56:49 +0000 (11:56 -0400)
commit36949938e83f1e3096d24b74d33f19512d014520
tree56aa05573cf38f8e5390085d20c8faaa1b079453
parent1ec2f7cfd6c1fa8acf9a41330df597af99dcadc7
Don't use and_() inside of Query.filter_by

Adjusted the :meth:`.Query.filter_by` method to not call :func:`.and()`
internally against multiple criteria, instead passing it off to
:meth:`.Query.filter` as a series of criteria, instead of a single criteria.
This allows :meth:`.Query.filter_by` to defer to :meth:`.Query.filter`'s
treatment of variable numbers of clauses, including the case where the list
is empty.  In this case, the :class:`.Query` object will not have a
``.whereclause``, which allows subsequent "no whereclause" methods like
:meth:`.Query.select_from` to behave consistently.

Fixes: #4606
Change-Id: Ifc8cdbf13accca2236068ef70114a7c35ab159ff
doc/build/changelog/unreleased_13/4606.rst [new file with mode: 0644]
lib/sqlalchemy/orm/query.py
test/orm/test_query.py