t27duck / active_reporting

OLAP-like DSL for ActiveRecord-based reporting
MIT License
136 stars 19 forks source link

default dimension_filters #29

Closed jnicho02 closed 5 years ago

jnicho02 commented 5 years ago

Dimension successfully defaults to using 'name', maybe a dimension_filter should do so as well.

e.g. assuming I have dimension :player in my FactModel, asking for dimension_filter: {player: 'Jez'} would filter on player.name = 'Jez'.... it would not require adding dimension_filter :player, ->(x) { joins(:player).where(players: {name: x}) } to the model.

t27duck commented 5 years ago

Filters are kind of meant to be free formed compared to anything else. Plus, filters can be for any column you want on any fact model and may also result in additional joins.

While fact models/tables, dimensions, etc follow a specific naming schema by default, you can make filters whatever you want. This is mainly due to the term "dimension filter" not really existing in OLAP.

jnicho02 commented 5 years ago

Fair enough about flexibility, but as a new user the first filter I tried was something simple and it surprised me by not working out-of-the-box in a similar way to dimension. I'm certainly not expecting more complex filters to work without setup. Pls close the issue if you feel it cannot/shouldn't be done. Or leave open to be implemented later