hasura / hasura/graphql-engine

Group by with data filters

Open
#6,953 5 comments 6 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Hi,
Need an out of the box solution for complex filters and dynamic grouping. To this end have described the ask below:
**Ask**:
- We want to group data by multiple columns.
- Need aggregates like count based on all the group criteria.
- We need to be able to filter the data before grouping. Data filtering should be possible on fields other than the grouping fields as well
- Need pagination across groups and within a group
- Need sort options for data within a group

**Approaches considered**:
- Aggregate fields work individually and cannot be combined. We need to group by multiple fields at a time and provide aggregations like count.
- A similar request has been made here: https://github.com/hasura/graphql-engine/issues/2965
- And a function based solution is described here: https://github.com/hasura/graphql-engine/discussions/3478

**Current approach**: Right now we are using the function based solution.

**Disadvantages of current approach**:
- The disadvantage of this approach is we need to ensure the function caters to the where clause as well.
- This is leading to fairly big and complex functions
- Maintenance required for additional relationships to fetch the underlying data after grouping

**Request**: Would be good to have these group and search capabilities for groups to be available out of the box

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.