Having Class
This class method is used to specify the filters to be applied on Grouped data during aggregation in dataloom. Below is a table detailing the parameters available for the Group class:
The following code cell demonstrates how we can filter in data aggregation using the Having class.
posts = mysql_loom.find_many(
Post,
select="id",
filters=Filter(column="id", operator="gt", value=1),
group=Group(
column="id",
function="MAX",
having=Having(column="id", operator="in", value=(2, 3, 4)),
return_aggregation_column=True,
),
)
Argument |
Description |
Type |
Default |
Required |
|
The name of the column to filter on. |
|
|
|
|
The operator to use for the filter. |
|
|
|
|
The value to compare against. |
|
|
|
|
The SQL operand to join the next filter with. |
|
|
Note
You can filter the groups in data aggregation using a single Having or multiple as a list.
See also - Group Class