From 9c1fa055bd64de6753386b0c0c9ccb03c23f9cb5 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Mon, 10 Jun 2024 17:45:43 -0700 Subject: [PATCH] Rename start/end to first/last --- .../generated_json_schemas/default_explicit_schema.json | 8 ++++---- dbt_semantic_interfaces/parsing/schemas.py | 2 +- dbt_semantic_interfaces/type_enums/period_agg.py | 4 ++-- tests/validations/test_metrics.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dbt_semantic_interfaces/parsing/generated_json_schemas/default_explicit_schema.json b/dbt_semantic_interfaces/parsing/generated_json_schemas/default_explicit_schema.json index b8d2486e..ad6a5785 100644 --- a/dbt_semantic_interfaces/parsing/generated_json_schemas/default_explicit_schema.json +++ b/dbt_semantic_interfaces/parsing/generated_json_schemas/default_explicit_schema.json @@ -104,11 +104,11 @@ }, "period_agg": { "enum": [ - "START", - "END", + "FIRST", + "LAST", "AVERAGE", - "start", - "end", + "first", + "last", "average" ] }, diff --git a/dbt_semantic_interfaces/parsing/schemas.py b/dbt_semantic_interfaces/parsing/schemas.py index f3b7e291..96d45143 100644 --- a/dbt_semantic_interfaces/parsing/schemas.py +++ b/dbt_semantic_interfaces/parsing/schemas.py @@ -57,7 +57,7 @@ export_destination_type_values = ["TABLE", "VIEW"] export_destination_type_values += [x.lower() for x in export_destination_type_values] -period_agg_values = ["START", "END", "AVERAGE"] +period_agg_values = ["FIRST", "LAST", "AVERAGE"] period_agg_values += [x.lower() for x in period_agg_values] diff --git a/dbt_semantic_interfaces/type_enums/period_agg.py b/dbt_semantic_interfaces/type_enums/period_agg.py index 24b8a5f1..9461420a 100644 --- a/dbt_semantic_interfaces/type_enums/period_agg.py +++ b/dbt_semantic_interfaces/type_enums/period_agg.py @@ -4,6 +4,6 @@ class PeriodAggregation(ExtendedEnum): """Options for how to aggregate across a time period.""" - START = "start" - END = "end" + FIRST = "first" + LAST = "last" AVERAGE = "average" diff --git a/tests/validations/test_metrics.py b/tests/validations/test_metrics.py index 62df676b..21d0043d 100644 --- a/tests/validations/test_metrics.py +++ b/tests/validations/test_metrics.py @@ -588,7 +588,7 @@ def test_cumulative_metrics() -> None: # noqa: D type_params=PydanticMetricTypeParams( measure=PydanticMetricInputMeasure(name=measure_name), window=PydanticMetricTimeWindow(count=1, granularity=TimeGranularity.WEEK), - cumulative_type_params=PydanticCumulativeTypeParams(period_agg=PeriodAggregation.END), + cumulative_type_params=PydanticCumulativeTypeParams(period_agg=PeriodAggregation.LAST), ), ), metric_with_guaranteed_meta( @@ -628,7 +628,7 @@ def test_cumulative_metrics() -> None: # noqa: D grain_to_date=TimeGranularity.MONTH, cumulative_type_params=PydanticCumulativeTypeParams( window=PydanticMetricTimeWindow(count=1, granularity=TimeGranularity.WEEK), - period_agg=PeriodAggregation.START, + period_agg=PeriodAggregation.FIRST, ), ), ), @@ -661,7 +661,7 @@ def test_cumulative_metrics() -> None: # noqa: D type=MetricType.CUMULATIVE, type_params=PydanticMetricTypeParams( measure=PydanticMetricInputMeasure(name=measure_name), - cumulative_type_params=PydanticCumulativeTypeParams(period_agg=PeriodAggregation.START), + cumulative_type_params=PydanticCumulativeTypeParams(period_agg=PeriodAggregation.FIRST), ), ), ],