summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-04-10 11:51:27 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-04-10 11:56:49 -0400
commit36949938e83f1e3096d24b74d33f19512d014520 (patch)
tree56aa05573cf38f8e5390085d20c8faaa1b079453 /lib/sqlalchemy
parent1ec2f7cfd6c1fa8acf9a41330df597af99dcadc7 (diff)
downloadsqlalchemy-36949938e83f1e3096d24b74d33f19512d014520.tar.gz
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
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/query.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index 9544b7d11..5d340654c 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -1791,7 +1791,7 @@ class Query(object):
_entity_descriptor(self._joinpoint_zero(), key) == value
for key, value in kwargs.items()
]
- return self.filter(sql.and_(*clauses))
+ return self.filter(*clauses)
@_generative(_no_statement_condition, _no_limit_offset)
def order_by(self, *criterion):