0

I have built normal filters using **kwargs to filter_by. Here by normal I mean, id = 123 for example. But what if I want to combine multiple filters such as id = 123 and date < 2022-01-01. For example:

select * from transaction t 
 where t.id = 123 and t.date < 2022-01-01;

I even tried using filter(*kwargs) but does not work.

filters = (
    Transaction.date < 2022-01-01,
    Transaction.id = 123,
)
db.session.query(Transaction).filter(*filters)

0 Answers0