From 1f5710d59fadfe0ea684196ebeb376af3c9826a5 Mon Sep 17 00:00:00 2001 From: Devon Fulcher <24593113+DevonFulcher@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:47:37 -0600 Subject: [PATCH] Add meta to dimensions, entities, and measures (#1561) This PR adds meta config to dimensions, entities, and measures. This is modeled off of [this](https://github.com/dbt-labs/metricflow/pull/1334/files) PR. --- .changes/unreleased/Features-20241210-110613.yaml | 6 ++++++ metricflow/engine/models.py | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 .changes/unreleased/Features-20241210-110613.yaml diff --git a/.changes/unreleased/Features-20241210-110613.yaml b/.changes/unreleased/Features-20241210-110613.yaml new file mode 100644 index 000000000..cc46891c7 --- /dev/null +++ b/.changes/unreleased/Features-20241210-110613.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Add meta to dimensions, entities, and measures +time: 2024-12-10T11:06:13.310255-06:00 +custom: + Author: DevonFulcher + Issue: None diff --git a/metricflow/engine/models.py b/metricflow/engine/models.py index 304a8bc93..ced963c8e 100644 --- a/metricflow/engine/models.py +++ b/metricflow/engine/models.py @@ -87,6 +87,7 @@ class Dimension: entity_links: Tuple[EntityReference, ...] type_params: Optional[DimensionTypeParams] metadata: Optional[Metadata] + config: Optional[SemanticLayerElementConfig] = None is_partition: bool = False expr: Optional[str] = None label: Optional[str] = None @@ -112,6 +113,7 @@ def from_pydantic( type=pydantic_dimension.type, type_params=parsed_type_params, metadata=pydantic_dimension.metadata, + config=pydantic_dimension.config, is_partition=pydantic_dimension.is_partition, expr=pydantic_dimension.expr, label=pydantic_dimension.label, @@ -142,6 +144,7 @@ class Entity: description: Optional[str] type: EntityType role: Optional[str] + config: Optional[SemanticLayerElementConfig] = None expr: Optional[str] = None @classmethod @@ -152,6 +155,7 @@ def from_pydantic(cls, pydantic_entity: SemanticManifestEntity) -> Entity: description=pydantic_entity.description, type=pydantic_entity.type, role=pydantic_entity.role, + config=pydantic_entity.config, expr=pydantic_entity.expr, ) @@ -163,6 +167,7 @@ class Measure: name: str agg: AggregationType agg_time_dimension: str + config: Optional[SemanticLayerElementConfig] = None description: Optional[str] = None expr: Optional[str] = None agg_params: Optional[MeasureAggregationParameters] = None