Let's say you have an Angular app and a backend piece and there's tabular data.
Let's say the users want to aggregate with average, sum etc across an arbitrary number of dimensions from the tabular data.
How do you design the backend to support this?
Dynamic sql?
How do you avoid SQL injection attacks if you provide the ability to define the select clause and group by clause at run time?
Alternatively do you just try to deliver grouping sets to cover the majority of the use cases or go all the way with group by cube across all dimensions?
What is the typical approach used for this kind of use case?
Currently I have a similar use case and I'm using grouping sets with grouping_id and I map a set of dimensions to a the given grouping_id that I filter the response on. So the user chooses their level of aggregation or currently at least the backend API is told the set of dimensions and these are then mapped to their corresponding grouping_id which is then used to filter out all the unwanted levels of aggregation from the result of the group by grouping sets call.
Assume that an OLAP solution is out of the question.