Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20251002-171248.yaml
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
from dbt_semantic_interfaces.implementations.semantic_manifest import (
PydanticSemanticManifest,
)
from dbt_semantic_interfaces.transformations.boolean_measure import (
BooleanMeasureAggregationRule,
from dbt_semantic_interfaces.transformations.flatten_simple_metrics_with_measure_inputs import (
FlattenSimpleMetricsWithMeasureInputsRule,
)
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.replace_input_measures_with_simple_metrics_transformation import (
ReplaceInputMeasuresWithSimpleMetricsTransformationRule,
)
from dbt_semantic_interfaces.transformations.semantic_manifest_transformer import (
PydanticSemanticManifestTransformer,
)
Expand All @@ -27,17 +26,21 @@ 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(),
# 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(),
Comment on lines +37 to +42
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're properly motivated, I can refactor this in dsi to make this cleaner here, but for now, I'd really like to get this in and working today.

*rule_set.general_metric_update_rules,
),
)
model = PydanticSemanticManifestTransformer.transform(raw_model, rules)
Expand Down