Skip to content

Commit

Permalink
fix: handle NotFound error when fetching explore against internal fields
Browse files Browse the repository at this point in the history
  • Loading branch information
drstrangelooker committed Dec 18, 2024
1 parent 36cd711 commit f4e3bba
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions henry/modules/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,31 @@ def get_explores(
assert isinstance(m.name, str)
assert isinstance(m.explores, list)
explores.extend(
[
self.sdk.lookml_model_explore(m.name, cast(str, e.name))
for e in m.explores
]
list(
filter(None,
[
self.lookml_model_explore(m.name, cast(str, e.name))
for e in m.explores
]
)
)
)
except error.SDKError:
raise exceptions.NotFoundError(
"An error occured while getting models/explores."
f"An error occured while getting model:{model}/explore:{explore}."
)
return explores

def lookml_model_explore(self, model: str, explore: str):
try:
return self.sdk.lookml_model_explore(model, explore)
except error.SDKError as e:
if e.message == 'Not found':
print(f"No Data Found while getting model {model}/explore {explore}.")
else:
raise
return []

def get_used_explores(
self, *, model: Optional[str] = None, explore: str = ""
) -> Dict[str, int]:
Expand Down

0 comments on commit f4e3bba

Please sign in to comment.