Skip to content

Commit edc42e5

Browse files
committed
feat(catalog): add metric_type property to CatalogMetric
Expose the metric type classification (UNSPECIFIED, CURRENCY) through the CatalogMetric.metric_type property. This allows SDK users to access the semantic categorization of metrics, particularly useful for currency-typed metrics. risk: low jira: DX-306
1 parent 6a58801 commit edc42e5

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

  • packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/entity_model/content_objects

packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/entity_model/content_objects/metric.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,20 @@ def format(self) -> Optional[str]:
2525
def is_hidden(self) -> Optional[bool]:
2626
return safeget(self.json_api_attributes, ["isHidden"])
2727

28+
@property
29+
def metric_type(self) -> Optional[str]:
30+
"""
31+
Returns the metric type classification.
32+
33+
Possible values:
34+
- "UNSPECIFIED" - Default type for metrics without semantic classification
35+
- "CURRENCY" - Metric represents a currency value
36+
- None - Not set
37+
38+
Returns:
39+
Optional[str]: The metric type or None if not set.
40+
"""
41+
return safeget(self.json_api_attributes, ["content", "metricType"])
42+
2843
def as_computable(self) -> Metric:
2944
return SimpleMetric(local_id=self.id, item=self.obj_id)

0 commit comments

Comments
 (0)