-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for bug with
get_min_queryable_time_granularity
(#1482)
This PR adds a test case to illustrate a bug with `MetricLookup.get_min_queryable_time_granularity()`. A fix for this test case is provided in a later PR.
- Loading branch information
Showing
21 changed files
with
479 additions
and
424 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...nifest_yamls/extended_date_manifest/metrics/monthly_bookings_to_daily_bookings_ratio.yaml
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,10 @@ | ||
--- | ||
metric: | ||
name: monthly_bookings_to_daily_bookings | ||
description: Ratio of daily bookings that are included in the monthly bookings total as a derived metric. | ||
type: ratio | ||
type_params: | ||
numerator: | ||
name: bookings | ||
denominator: | ||
name: bookings_monthly |
13 changes: 7 additions & 6 deletions
13
...mantic_manifest_yamls/extended_date_manifest/semantic_models/bookings_monthly_source.yaml
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
25 changes: 25 additions & 0 deletions
25
metricflow-semantics/tests_metricflow_semantics/model/semantics/test_metric_lookup.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,25 @@ | ||
from __future__ import annotations | ||
|
||
import logging | ||
|
||
import pytest | ||
from dbt_semantic_interfaces.references import MetricReference | ||
from dbt_semantic_interfaces.type_enums import TimeGranularity | ||
from metricflow_semantics.model.semantic_manifest_lookup import SemanticManifestLookup | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@pytest.mark.skip("get_min_queryable_time_granularity has a bug with agg. time dimensions at different grains.") | ||
def test_min_queryable_time_granularity_for_different_agg_time_grains( # noqa: D103 | ||
extended_date_semantic_manifest_lookup: SemanticManifestLookup, | ||
) -> None: | ||
metric_lookup = extended_date_semantic_manifest_lookup.metric_lookup | ||
|
||
min_queryable_grain = metric_lookup.get_min_queryable_time_granularity( | ||
MetricReference("monthly_bookings_to_daily_bookings") | ||
) | ||
|
||
# Since `monthly_bookings_to_daily_bookings` is based on metrics with DAY and MONTH aggregation time grains, | ||
# the minimum queryable grain should be MONTH. | ||
assert min_queryable_grain == TimeGranularity.MONTH |
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.