From 054e26fbe2c9dd8882174f0e1f8ef8ec6a104244 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Thu, 18 Apr 2024 16:48:35 -0700 Subject: [PATCH] Update documentation --- metricflow/model/semantics/linkable_spec_resolver.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/metricflow/model/semantics/linkable_spec_resolver.py b/metricflow/model/semantics/linkable_spec_resolver.py index 7cb75d28a2..d5e2cb8bbd 100644 --- a/metricflow/model/semantics/linkable_spec_resolver.py +++ b/metricflow/model/semantics/linkable_spec_resolver.py @@ -630,9 +630,12 @@ def _get_joinable_metrics_for_semantic_model( """Get the set of linkable metrics that can be joined to this semantic model.""" properties = frozenset({LinkableElementProperty.METRIC, LinkableElementProperty.JOINED}) if using_join_path: - assert ( - semantic_model.reference == using_join_path.last_semantic_model_reference - ), "Last join path element should match semantic model when building LinkableMetrics." + assert semantic_model.reference == using_join_path.last_semantic_model_reference, ( + "Last join path element should match semantic model when building LinkableMetrics. " + f"Got semantic model: {semantic_model.reference.semantic_model_name}; " + f"last join path element: {using_join_path.last_semantic_model_reference.semantic_model_name}", + ) + # TODO: confirm that this is what we internally consider multi-hop properties = properties.union(frozenset({LinkableElementProperty.MULTI_HOP})) path_key_to_linkable_metrics: Dict[ElementPathKey, Tuple[LinkableMetric, ...]] = {} @@ -657,6 +660,7 @@ def _get_elements_in_semantic_model(self, semantic_model: SemanticModel) -> Link """Gets the elements in the semantic model, without requiring any joins. Elements related to metric_time are handled separately in _get_metric_time_elements(). + Linkable metrics are not considered local to the semantic model since they always require a join. """ linkable_dimensions = [] linkable_entities = []