Group Class

This class is used for data aggregation and grouping data in dataloom. Below is a table detailing the parameters available for the Group class

The following code cell demonstrates how we can do data aggregation using the Group class.

posts = mysql_loom.find_many(
    Post,
    select="id",
    filters=Filter(column="id", operator="gt", value=1),
    group=Group(
        column="id",
        function="MAX",
        return_aggregation_column=True,
    ),
)

Argument

Description

Type

Default

Required

column

The name of the column to group by.

str

Yes

function

The aggregation function to apply on the grouped data.

"COUNT" or "AVG" or "SUM" or "MIN" or "MAX"

"COUNT"

No

having

Filters to apply to the grouped data.

list[Having] or Having or None

None

No

return_aggregation_column

Whether to return the aggregation column in the result.

bool

False

No

Note

You can include a single or multiple groups when doing data aggregation in dataloom. You can filter the data while grouping using the Having class.