From 6545bc136a085f0b33c2f44e5173786f4c9e22fe Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Wed, 8 Nov 2023 15:13:33 -0800 Subject: [PATCH] Rename YAML -> config --- metricflow/model/semantics/metric_lookup.py | 6 +++--- metricflow/plan_conversion/dataflow_to_sql.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/metricflow/model/semantics/metric_lookup.py b/metricflow/model/semantics/metric_lookup.py index ceead8a09f..f43348821d 100644 --- a/metricflow/model/semantics/metric_lookup.py +++ b/metricflow/model/semantics/metric_lookup.py @@ -106,11 +106,11 @@ def add_metric(self, metric: Metric) -> None: ) self._metrics[metric_reference] = metric - def yaml_input_measure_for_metric(self, metric_reference: MetricReference) -> Optional[MetricInputMeasure]: - """Get input measure defined in the metric YAML, if exists. + def configured_input_measure_for_metric(self, metric_reference: MetricReference) -> Optional[MetricInputMeasure]: + """Get input measure defined in the original metric config, if exists. When SemanticModel is constructed, input measures from input metrics are added to the list of input measures - for a metric. Here, use rules about metric types to determine which input measures were defined in the YAML: + for a metric. Here, use rules about metric types to determine which input measures were defined in the config: - Simple & cumulative metrics require one input measure, and can't take any input metrics. - Derived & ratio metrics take no input measures, only input metrics. """ diff --git a/metricflow/plan_conversion/dataflow_to_sql.py b/metricflow/plan_conversion/dataflow_to_sql.py index e873d69d0c..87f1471dbf 100644 --- a/metricflow/plan_conversion/dataflow_to_sql.py +++ b/metricflow/plan_conversion/dataflow_to_sql.py @@ -898,7 +898,9 @@ def _make_select_columns_for_multiple_metrics( # At this point, the MetricSpec might have the alias in place of the element name, so we need to look # back at where it was defined from to get the metric element name. metric_reference = MetricReference(element_name=metric_instance.defined_from.metric_name) - input_measure = self._metric_lookup.yaml_input_measure_for_metric(metric_reference=metric_reference) + input_measure = self._metric_lookup.configured_input_measure_for_metric( + metric_reference=metric_reference + ) if input_measure and input_measure.fill_nulls_with is not None: select_expression = SqlAggregateFunctionExpression( sql_function=SqlFunction.COALESCE,