Skip to content

Commit

Permalink
Use new logic for finding linkable metrics (from previous commit) in …
Browse files Browse the repository at this point in the history
…create_linkable_element_set_from_join_path
  • Loading branch information
courtneyholcomb committed Apr 18, 2024
1 parent 5b9210d commit b3d54a8
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions metricflow/model/semantics/linkable_spec_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,6 @@ def create_linkable_element_set_from_join_path(

linkable_dimensions: List[LinkableDimension] = []
linkable_entities: List[LinkableEntity] = []
linkable_metrics: List[LinkableMetric] = []

for dimension in semantic_model.dimensions:
dimension_type = dimension.type
Expand Down Expand Up @@ -1060,25 +1059,14 @@ def create_linkable_element_set_from_join_path(
)
)

linkable_metrics = [
LinkableMetric(
element_name=metric.element_name,
entity_links=join_path.entity_links,
join_path=join_path.path_elements,
join_by_semantic_model=semantic_model.reference,
properties=properties.union({LinkableElementProperty.METRIC}),
)
for metric in self._joinable_metrics_for_semantic_models.get(join_path.last_semantic_model_reference, set())
]

return LinkableElementSet(
path_key_to_linkable_dimensions={
linkable_dimension.path_key: (linkable_dimension,) for linkable_dimension in linkable_dimensions
},
path_key_to_linkable_entities={
linkable_entity.path_key: (linkable_entity,) for linkable_entity in linkable_entities
},
path_key_to_linkable_metrics={
linkable_metric.path_key: (linkable_metric,) for linkable_metric in linkable_metrics
},
path_key_to_linkable_metrics=self._get_joinable_metrics_for_semantic_model(
semantic_model=semantic_model, using_join_path=join_path
).path_key_to_linkable_metrics,
)

0 comments on commit b3d54a8

Please sign in to comment.