Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed May 31, 2024
1 parent cd6b9d9 commit f3e8c6d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]
2 changes: 1 addition & 1 deletion metricflow/dataset/convert_semantic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions metricflow/plan_conversion/time_spine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand All @@ -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:
Expand All @@ -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)}"
)
Expand Down

0 comments on commit f3e8c6d

Please sign in to comment.