Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update support for custom granularity in other types #365

Merged
merged 13 commits into from
Nov 12, 2024

Conversation

WilliamDee
Copy link
Contributor

Description

Support custom grain by switching the typing to be not on TimeGranularity

  • Metric.time_granularity - TimeGranularity -> str
  • Metric.type_params.cumulative_type_params.grain_to_date - TimeGranularity -> str
  • MetricInput.offset_to_grain - TimeGranularity -> str
  • MetricTimeWindow.granularity - TimeGranularity -> str affects the following
    • Metric.type_params.conversion_type_params.window
    • Metric.type_params.cumulative_type_params.window
    • MetricInput.offset_window

Changes to MetricTimeWindow

Because MetricTimeWindow.granularity is now a string, we allow it to be not as strict when ensuring it's a valid granularity during initial yaml parsing (since we don't have access to the custom granularities). Then during validations, we will properly validate that it's a valid grain, and during the transformation step we will remove trailing 's'.

Checklist

Resolves SL-2826

@WilliamDee WilliamDee requested review from QMalcolm, graciegoheen and a team as code owners November 9, 2024 02:58
Copy link

linear bot commented Nov 9, 2024

@cla-bot cla-bot bot added the cla:yes label Nov 9, 2024
Copy link

github-actions bot commented Nov 9, 2024

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

1 similar comment
Copy link

github-actions bot commented Nov 9, 2024

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

Copy link
Contributor

@courtneyholcomb courtneyholcomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One concern about case sensitivity but otherwise looks good!!

@WilliamDee WilliamDee force-pushed the will/update-custom-grain-for-windows branch from a88441c to 256eb9d Compare November 11, 2024 21:01
Base automatically changed from will/support-custom-grain to main November 11, 2024 23:19
@WilliamDee WilliamDee force-pushed the will/update-custom-grain-for-windows branch from 256eb9d to 3d873b0 Compare November 11, 2024 23:20
@WilliamDee WilliamDee merged commit b7ce0aa into main Nov 12, 2024
22 checks passed
@WilliamDee WilliamDee deleted the will/update-custom-grain-for-windows branch November 12, 2024 07:19
WilliamDee added a commit to dbt-labs/metricflow that referenced this pull request Dec 5, 2024
## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants