diff --git a/metricflow-semantics/metricflow_semantics/time/time_constants.py b/metricflow-semantics/metricflow_semantics/time/time_constants.py index 3c66216a1d..6cf0e2358e 100644 --- a/metricflow-semantics/metricflow_semantics/time/time_constants.py +++ b/metricflow-semantics/metricflow_semantics/time/time_constants.py @@ -5,11 +5,3 @@ # Python formatting string to use for converting datetime to ISO8601 ISO8601_PYTHON_FORMAT = "%Y-%m-%d" ISO8601_PYTHON_TS_FORMAT = "%Y-%m-%d %H:%M:%S" - -SUPPORTED_GRANULARITIES = [ - TimeGranularity.DAY, - TimeGranularity.WEEK, - TimeGranularity.MONTH, - TimeGranularity.QUARTER, - TimeGranularity.YEAR, -] diff --git a/metricflow/dataset/convert_semantic_model.py b/metricflow/dataset/convert_semantic_model.py index 964d0d4b50..f45d2fe102 100644 --- a/metricflow/dataset/convert_semantic_model.py +++ b/metricflow/dataset/convert_semantic_model.py @@ -283,7 +283,7 @@ def _convert_time_dimension( time_dimension_instances: List[TimeDimensionInstance] = [] select_columns: List[SqlSelectColumn] = [] - defined_time_granularity = TimeGranularity.DAY + defined_time_granularity = DEFAULT_TIME_GRANULARITY if dimension.type_params and dimension.type_params.time_granularity: defined_time_granularity = dimension.type_params.time_granularity diff --git a/metricflow/plan_conversion/time_spine.py b/metricflow/plan_conversion/time_spine.py index 38669b4e3e..dc2355cb78 100644 --- a/metricflow/plan_conversion/time_spine.py +++ b/metricflow/plan_conversion/time_spine.py @@ -6,7 +6,7 @@ from dbt_semantic_interfaces.protocols import SemanticManifest from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity from metricflow_semantics.mf_logging.pretty_print import mf_pformat - +from metricflow_semantics.specs.spec_classes import DEFAULT_TIME_GRANULARITY from metricflow.sql.sql_table import SqlTable logger = logging.getLogger(__name__) @@ -23,7 +23,7 @@ class TimeSpineSource: # Name of the column in the table that contains the dates. time_column_name: str = "ds" # The time granularity of the dates in the spine table. - time_column_granularity: TimeGranularity = TimeGranularity.DAY + time_column_granularity: TimeGranularity = DEFAULT_TIME_GRANULARITY @property def spine_table(self) -> SqlTable: @@ -37,10 +37,10 @@ def create_from_manifest(semantic_manifest: SemanticManifest) -> TimeSpineSource if not ( len(time_spine_table_configurations) == 1 - and time_spine_table_configurations[0].grain == TimeGranularity.DAY + and time_spine_table_configurations[0].grain == DEFAULT_TIME_GRANULARITY ): raise NotImplementedError( - f"Only a single time spine table configuration with {TimeGranularity.DAY} is currently " + f"Only a single time spine table configuration with {DEFAULT_TIME_GRANULARITY} is currently " f"supported. Got:\n" f"{mf_pformat(time_spine_table_configurations)}" )