looker-open-source / henry

A command line tool for Looker instance cleanup
MIT License
79 stars 27 forks source link

Feature request - setting to treat dimension groups as one field #19

Open moseleyi opened 4 years ago

moseleyi commented 4 years ago
dimension_group: created_at{
    type: time
    timeframes: [ raw, time, date, week, month, quarter, year, day_of_week ]
    sql: ${TABLE}.created_at;;
  }

Sometimes only one of the timeframes might be used across the explores but, as it's in my case, we prefer to keep the timeframes list pretty standardised.

At the moment Henry will treat each timeframe as a separate field, which could give us a wrong impression that the field itself is not used by any timeframe.

+---------+-----------------+----------------+------------------------------------+
| Model   | Explore         | Unused Joins   | Unused Fields                      |
|---------+-----------------+----------------+------------------------------------|
| model   | explore         |                | explore.created_at_day_of_week     |
|         |                 |                | explore.created_at_month           |
|         |                 |                | explore.created_at_quarter         |
|         |                 |                | explore.created_at_time            |
|         |                 |                | explore.created_at_week            |
|         |                 |                | explore.created_at_year            |

Perhaps if I remember all the timeframes we use in our data model, I could quickly decide whether anything is missing. Problem is that even if we want to standardise something, doesn't mean that ocassionally timeframes might differ.

It would be great if we could change the way Henry treats those fields. In this case created_at would be one field and treated as used if at least one of its timeframes is used