-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Feature description
Ideally I would there to be a way to have different filters for different aggregates in the same query, so something like the following example SQL can be generated:
SELECT
conv_date AS date,
COUNT(*) FILTER (WHERE visitor_status = 'new') AS new_count,
SUM(revenue) FILTER (WHERE visitor_status = 'new') AS new_revenue,
COUNT(*) FILTER (WHERE visitor_status = 'returning') AS returning_count,
SUM(revenue) FILTER (WHERE visitor_status = 'returning') AS returning_revenue
FROM picked
WHERE someother_condition = 1
GROUP BY conv_date
ORDER BY conv_date;
I'm not sure what's the best way for the GraphQL to look like to generate this kind of queries.
This doesn't have to be added out of the box, but rather could be provided as custom function or something similar to defining our own aggreations.
I asked about this and was suggested to post here.
Motivating example
We do many aggregations in our frontend and generate graphs for them. It's cumbersome to create a view with all possible combinations of filters so would be nice if this query could be natively expressed in GraphQL.
Metadata
Metadata
Assignees
Labels
No labels