Global Analytics
I'm trying to generate global analytics from my resources:
- my first attempt was to define aggregates on the resources itself but in my understanding those only work within relationships
- now I'm working my way through defining a dataless resource which has a bunch of
no_attributes? true
relationships but I'm getting some errors including
Before I keep digging in this direction, is there an idiomatic way to generate analytics with global aggregation that do not have any entypoint resource?5 Replies
My suggestion is to use Ecto for this. We have have some features for reporting/analytics in the future but right now it's just not a strong suit. You can use your Ash resources as Ecto queries directly.
ok, yeah looks like aggregates only work with a datelayer supported resource, any variation of this
returns
%Ash.Error.Query.AggregatesNotSupported{
looks like this works just fine without using Ecto
Read actions should return lists of records
You should prefer generic actions for what you're doing.
the manual ready allow me to expose the action to the graphql interface without having to specify the type, am I wrong?
But it would be an incorrect type
AshGraphql supports generic actions
Ohhh sorry
I realize you're making it a record nvm
I thought you were just returning an integer
I think I would still do a generic action since it can't be filtered etc and only ever returns a single thing