From 59c000f2a28231f97a9fd2258f97535ab17b6af4 Mon Sep 17 00:00:00 2001 From: Patrick Yost Date: Thu, 2 Oct 2025 12:31:06 -0700 Subject: [PATCH 1/3] Get MF using the new dsi transformations --- .../model/dbt_manifest_parser.py | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/metricflow-semantics/metricflow_semantics/model/dbt_manifest_parser.py b/metricflow-semantics/metricflow_semantics/model/dbt_manifest_parser.py index 638da5283f..0ab3db1ece 100644 --- a/metricflow-semantics/metricflow_semantics/model/dbt_manifest_parser.py +++ b/metricflow-semantics/metricflow_semantics/model/dbt_manifest_parser.py @@ -3,16 +3,8 @@ from dbt_semantic_interfaces.implementations.semantic_manifest import ( PydanticSemanticManifest, ) -from dbt_semantic_interfaces.transformations.boolean_measure import ( - BooleanMeasureAggregationRule, -) -from dbt_semantic_interfaces.transformations.convert_count import ConvertCountToSumRule -from dbt_semantic_interfaces.transformations.convert_median import ( - ConvertMedianToPercentileRule, -) -from dbt_semantic_interfaces.transformations.cumulative_type_params import SetCumulativeTypeParamsRule from dbt_semantic_interfaces.transformations.names import LowerCaseNamesRule -from dbt_semantic_interfaces.transformations.proxy_measure import CreateProxyMeasureRule +from dbt_semantic_interfaces.transformations.pydantic_rule_set import PydanticSemanticManifestTransformRuleSet from dbt_semantic_interfaces.transformations.semantic_manifest_transformer import ( PydanticSemanticManifestTransformer, ) @@ -27,17 +19,16 @@ def parse_manifest_from_dbt_generated_manifest(manifest_json_string: str) -> Pyd # this time, which causes failures with input measure resolution. # TODO: remove this transform call once the upstream changes are integrated into our dependency tree # TODO: align rules between DSI, here, and MFS (if possible!) + rule_set = PydanticSemanticManifestTransformRuleSet() rules = ( # Primary (LowerCaseNamesRule(),), - # Secondary + # Secondary - broken out into groups because we run DedupeMetricInputMeasuresRule in the middle. ( - CreateProxyMeasureRule(), - BooleanMeasureAggregationRule(), - ConvertCountToSumRule(), - ConvertMedianToPercentileRule(), + *rule_set.legacy_measure_update_rules, DedupeMetricInputMeasuresRule(), # Remove once fix is in core - SetCumulativeTypeParamsRule(), + *rule_set.convert_legacy_measures_to_metrics_rules, + *rule_set.general_metric_update_rules, ), ) model = PydanticSemanticManifestTransformer.transform(raw_model, rules) From d0c497ebfb56c4f727c9140aef59a03a725965ee Mon Sep 17 00:00:00 2001 From: Patrick Yost Date: Thu, 2 Oct 2025 17:13:21 -0700 Subject: [PATCH 2/3] Add changie file. --- .changes/unreleased/Features-20251002-171248.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Features-20251002-171248.yaml diff --git a/.changes/unreleased/Features-20251002-171248.yaml b/.changes/unreleased/Features-20251002-171248.yaml new file mode 100644 index 0000000000..2bd88b79af --- /dev/null +++ b/.changes/unreleased/Features-20251002-171248.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Add new transformations to production from dsi that produce metrics from old-style measures. +time: 2025-10-02T17:12:48.436607-07:00 +custom: + Author: theyostalservice + Issue: "387" From 54b29ef75521f2992efbf5c2034723cbb7c3a769 Mon Sep 17 00:00:00 2001 From: Patrick Yost Date: Fri, 3 Oct 2025 08:44:41 -0700 Subject: [PATCH 3/3] Remove AddInputMetricMeasuresRule because it's incompatible with MF and core. --- .../model/dbt_manifest_parser.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/metricflow-semantics/metricflow_semantics/model/dbt_manifest_parser.py b/metricflow-semantics/metricflow_semantics/model/dbt_manifest_parser.py index 0ab3db1ece..04153e3dc9 100644 --- a/metricflow-semantics/metricflow_semantics/model/dbt_manifest_parser.py +++ b/metricflow-semantics/metricflow_semantics/model/dbt_manifest_parser.py @@ -3,8 +3,15 @@ from dbt_semantic_interfaces.implementations.semantic_manifest import ( PydanticSemanticManifest, ) +from dbt_semantic_interfaces.transformations.flatten_simple_metrics_with_measure_inputs import ( + FlattenSimpleMetricsWithMeasureInputsRule, +) from dbt_semantic_interfaces.transformations.names import LowerCaseNamesRule +from dbt_semantic_interfaces.transformations.proxy_measure import CreateProxyMeasureRule from dbt_semantic_interfaces.transformations.pydantic_rule_set import PydanticSemanticManifestTransformRuleSet +from dbt_semantic_interfaces.transformations.replace_input_measures_with_simple_metrics_transformation import ( + ReplaceInputMeasuresWithSimpleMetricsTransformationRule, +) from dbt_semantic_interfaces.transformations.semantic_manifest_transformer import ( PydanticSemanticManifestTransformer, ) @@ -27,7 +34,12 @@ def parse_manifest_from_dbt_generated_manifest(manifest_json_string: str) -> Pyd ( *rule_set.legacy_measure_update_rules, DedupeMetricInputMeasuresRule(), # Remove once fix is in core - *rule_set.convert_legacy_measures_to_metrics_rules, + # These individual rules come from rule_set.convert_legacy_measures_to_metrics_rules, but + # dsi requires AddInputMetricMeasuresRule, and metricflow requires that we do NOT run that rule + # as it is incompatible with a parser like dbt-core that pre-populates input measures. + CreateProxyMeasureRule(), + FlattenSimpleMetricsWithMeasureInputsRule(), + ReplaceInputMeasuresWithSimpleMetricsTransformationRule(), *rule_set.general_metric_update_rules, ), )