t27duck / active_reporting

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

add support to implicit hierarchical on datetime columns #33

Closed germanotm closed 4 years ago

germanotm commented 4 years ago

I found a solution to group by date dimension hierarchies on mysql database. To achieve this i changed the ReportingDimension# degenerate_select_fragment to use [Mysql Date and Time Functions] (https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html ) to create a select fragment with same postgress date_trunc behavior.

The options on mysql are not exactly the same of postgress, so i decide to support all, and only, postgress date_trunc values. It probably will be enough for mysql users and that way i keep the ActiveReport API consistent.

Please let me know what you thing, and any feedback about the code will be apreciate.

germanotm commented 4 years ago

Don't know what breaks pg environment, i did not test pg it on my machine. Will check the error tomorrow.

germanotm commented 4 years ago

I have fixed the tests on postgres database.

t27duck commented 4 years ago

Looks good. I will probably go back later and some some misc cleanup on some parts before I think about a new release, but I consider the core work for this done. Not sure when I'll get to it, so it may be worth pulling the gem from master until that happens.

Thanks