looker-open-source / henry

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

Feature request - ability to see Used Fields #18

Open moseleyi opened 4 years ago

moseleyi commented 4 years ago

Right now while using vacuum command we get a great list of all the fields that are not used but I think it would be useful to get the context of the fields that are being used. Especially when we consider using the dimension_group and timeframes

One of the ideas I had was to add a different way of formatting the output.

1, Order by field name and indicate whether it's used or not

explore.field
explore.field_time    USED
explore.field2_raw    NOT USED
  1. Order by used/unused

    explore.field2_time    USED
    explore.field          USED
    explore.field2_raw     NOT_USED
  2. Separate column for used

    +---------+-----------------+----------------+------------------------------------------------------------------+-------------------------------+
    | Model   | Explore         | Unused Joins   | Unused Fields                                                    | Used Fields                   |
    |---------+-----------------+----------------+------------------------------------------------------------------|-------------------------------|
    | model   | explore         |                | explore.field2_raw                                               | explore.field2_time           |
    |         |                 |                |                                                                  | explore.field                 |
  3. Separate column for used but with the used list matching the line of the unused - this only makes sense for dimension_group

    +---------+-----------------+----------------+------------------------------------------------------------------+-------------------------------+
    | Model   | Explore         | Unused Joins   | Unused Fields                                                    | Used Fields                   |
    |---------+-----------------+----------------+------------------------------------------------------------------|-------------------------------|
    | model   | explore         |                | explore.field_raw                                                |                               |
    | model   | explore         |                | explore.field_time                                               |                               |
    | model   | explore         |                | explore.field_month                                              |                               |
    | model   | explore         |                | explore.field_year                                               |                               |
    | model   | explore         |                | explore.field_date                                               |                               |
    | model   | explore         |                | explore.field2_raw                                               | explore.field2_time           |
    | model   | explore         |                | explore.field2_month                                             |                               |
    | model   | explore         |                | explore.field2_year                                              |                               |