From e34e8fc2cbe9edeae7b76c882a5450b1b2d7c36a Mon Sep 17 00:00:00 2001 From: Will Deng Date: Fri, 19 Jan 2024 19:31:36 -0500 Subject: [PATCH] expose meta in Metric --- dbt_semantic_interfaces/implementations/metric.py | 3 ++- dbt_semantic_interfaces/protocols/metric.py | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dbt_semantic_interfaces/implementations/metric.py b/dbt_semantic_interfaces/implementations/metric.py index 04b4c8a4..2ae26899 100644 --- a/dbt_semantic_interfaces/implementations/metric.py +++ b/dbt_semantic_interfaces/implementations/metric.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import List, Optional, Sequence +from typing import Any, Dict, List, Optional, Sequence from dbt_semantic_interfaces.enum_extension import assert_values_exhausted from dbt_semantic_interfaces.errors import ParsingException @@ -180,6 +180,7 @@ class PydanticMetric(HashableBaseModel, ModelWithMetadataParsing): filter: Optional[PydanticWhereFilterIntersection] metadata: Optional[PydanticMetadata] label: Optional[str] = None + meta: Dict[str, Any] @property def input_measures(self) -> Sequence[PydanticMetricInputMeasure]: diff --git a/dbt_semantic_interfaces/protocols/metric.py b/dbt_semantic_interfaces/protocols/metric.py index 66b48dd1..f5ac49e6 100644 --- a/dbt_semantic_interfaces/protocols/metric.py +++ b/dbt_semantic_interfaces/protocols/metric.py @@ -1,7 +1,7 @@ from __future__ import annotations from abc import abstractmethod -from typing import Optional, Protocol, Sequence +from typing import Any, Dict, Optional, Protocol, Sequence from dbt_semantic_interfaces.protocols.metadata import Metadata from dbt_semantic_interfaces.protocols.where_filter import WhereFilterIntersection @@ -280,6 +280,12 @@ def input_metrics(self) -> Sequence[MetricInput]: def metadata(self) -> Optional[Metadata]: # noqa: D pass + @property + @abstractmethod + def meta(self) -> Dict[str, Any]: + """The meta field can be used to set metadata for a resource.""" + pass + @property @abstractmethod def label(self) -> Optional[str]: