You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add groupby/aggregation support for PostgreSQL in GraphQL (#3741)
## Why make this change?
Closes#2850. This PR adds support for group by and aggregation in
PostgreSQL in GraphQL queries.
## What is this change?
Groupby and aggregation types/enums were added to the GraphQL schema in
PostgreSQL, but they essentially were orphaned because the user couldn't
utilize them in their GraphQL query. This PR hooks up the
groupby/aggregation schema types/enums into a GraphQL input query.
## How was this tested?
- [X] Integration Tests
## Sample Request(s)
```
query {
stocks_prices {
groupBy(fields: [categoryid, pieceid]) {
fields {
categoryid
pieceid
}
aggregations {
total: sum(field: price)
count: count(field: pieceid, having: { gt: 5 })
}
}
}
}
```
Previously, a query such as the one above would fail because the
`groupBy` field would not have been attached to the `stocks_prices`
object type. This PR adds the `groupBy` field to the relevant list query
entity types. The `groupBy` field serves as a window to the rest of the
groupBy/aggregation query.
---------
Co-authored-by: Anusha Kolan <anushakolan10@gmail.com>
(cherry picked from commit 7ad4f49)
0 commit comments