-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update MF to support breaking changes in DSI for custom calendar (#1522)
## Context We merged 2 breaking changes in DSI dbt-labs/dbt-semantic-interfaces#363 and dbt-labs/dbt-semantic-interfaces#365 which changed most spec typing that used time granularity to be a `str` instead of `TimeGranularity` to enable support for custom granularity. Similarly, there were additional breaking changes to the objects that requires passing in `custom_granularity_names`. This PR updates all those callsites to be compatible with the new version of DSI (to be released) Resolves SL-3097
- Loading branch information
1 parent
5bb1351
commit 5cd5d40
Showing
45 changed files
with
597 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
metricflow-semantics/extra-hatch-configuration/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Always support a range of production DSI versions capped at the next breaking version in metricflow-semantics. | ||
# This allows us to sync new, non-breaking changes to dbt-core without getting a version mismatch in dbt-mantle, | ||
# which depends on a specific commit of DSI. | ||
dbt-semantic-interfaces>=0.7.2, <0.8.0 | ||
dbt-semantic-interfaces>=0.8.3, <0.9.0 | ||
graphviz>=0.18.2, <0.21 | ||
python-dateutil>=2.9.0, <2.10.0 | ||
rapidfuzz>=3.0, <4.0 |
20 changes: 20 additions & 0 deletions
20
metricflow-semantics/metricflow_semantics/errors/custom_grain_not_supported.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Optional | ||
|
||
from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity | ||
|
||
|
||
def error_if_not_standard_grain(input_granularity: str, context: Optional[str] = None) -> TimeGranularity: | ||
"""Cast input grainularity string to TimeGranularity, otherwise error. | ||
TODO: Not needed once, custom grain is supported for most things. | ||
""" | ||
try: | ||
time_grain = TimeGranularity(input_granularity) | ||
except ValueError: | ||
error_msg = f"Received a non-standard time granularity, which is not supported at the moment, received: {input_granularity}." | ||
if context: | ||
error_msg += f"\nContext: {context}" | ||
raise ValueError(error_msg) | ||
return time_grain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.