Group By query in read, calculation, aggregate or custom action?

Where and how would you run a GROUP BY query in Ash? read actions return a list, but without an id for the resource. I couldn’t find examples in aggregates or calculations.

SELECT count(1), title FROM posts GROUP BY title

You wouldn’t :slight_smile: you should use Ecto directly for that.

Ash doesn’t do policies or filter by actor for group by? I thought it would be like an aggregate or calculation.

Nope. I’ve added Ash.data_layer_query (unreleased, only in main) which would help you build a query w/ authorization logic applied.

1 Like