Skip to content

Edge Cases: Extensions

Joseph Axisa edited this page Apr 11, 2019 · 1 revision

Extensions

As LookML models grow, it is often the case that developers start leveraging extensions to re-use code and maintain a clean model. This page is an attempt at describing how Henry works with various extension uses.

Explores with extension: required

Consider an explore that uses the extension: required parameter. This means that the explore is automatically hidden from users and is only exposed through explores that extend it. As a result, trying to analyze/vacuum that explore with Henry will be futile as it will not show anywhere and an error will be returned. The explore doing the extending should be vacuum instead.

Finally, note that a base_model containing only explores with extension_required is equivalent to a model containing only hidden explores and will show as having no unused explores.

Other extended explores

Consider a base explore base_explore which is extended as follows:

explore: base_explore {
  from: users
}

explore: extension {
  extends: [base_explore]
}

Both explores are shown in the explore menu and have the same exposed fields. However, Henry considers them mutually exclusive. That is, if a field is not used in extension, it does not show as unused in base_explore if it has been used there. Conversely, if a field is used in base_explore, it does not show as used in extension unless it has been used there.

The recommendation for unused fields in the base_explore is to exclude them using the fields: parameter. One must be careful to override this parameter in the extension if the excluded fields are needed there. On the other hand, if a field is not needed in both these explores but might be useful in another context then it is best to concatenate the fields list from base_explore with that of extension using the EXTENDED* set. Finally, if it's not useable anywhere else it can be hidden or removed altogether from the view file.