looker-open-source / henry

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

Fix AssertionError raised for dimension/measure only explores #14

Closed josephaxisa closed 4 years ago

josephaxisa commented 4 years ago

Problem

Explores containing just dimensions (or only measures) fail on L208, introduced due to dimensions and measures having an optional type because of the fields parameter of GET /lookml_models/{lookml_model_name}/explores/{explore_name}.

https://github.com/looker-open-source/henry/blob/45893109b7ec0d4df8927d9a49bc630443662555/henry/modules/fetcher.py#L201-L212

Solution

Since the request in get_explores does not include the fields param, the response will contain these attributes, even though they can be empty lists. https://github.com/looker-open-source/henry/blob/45893109b7ec0d4df8927d9a49bc630443662555/henry/modules/fetcher.py#L137 As a result, I removed the assertions and told mypy to look the other way.