I want to use bool_and
aggregate function for GROUP BY, but I do not understand how to implement it in SQLAlchemy. I have tried func.and_
but it does not seem to work.
You can create (almost) any SQL function expression from func
by its name:
Note that any name not known to
func
generates the function name as is - there is no restriction on what SQL functions can be called, known or unknown to SQLAlchemy, built-in or user defined.
So the answer is just:
func.bool_and(...)
There are some functions that are known to SQLAlchemy and get special treatment, such as CURRENT_TIMESTAMP
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With