From 42552aa4e9359423c09b7dbac463517435a9666d Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Thu, 6 Jun 2024 18:54:41 -0700 Subject: [PATCH 1/2] Support sub-daily granularity in YAML configs --- .../default_explicit_schema.json | 24 +++++++++++++++++++ dbt_semantic_interfaces/parsing/schemas.py | 14 ++++++++++- .../semantic_models/id_verifications.yaml | 2 +- 3 files changed, 38 insertions(+), 2 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 dde90bbc..38047288 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 @@ -131,11 +131,23 @@ "properties": { "time_granularity": { "enum": [ + "NANOSECOND", + "MICROSECOND", + "MILLISECOND", + "SECOND", + "MINUTE", + "HOUR", "DAY", "WEEK", "MONTH", "QUARTER", "YEAR", + "nanosecond", + "microsecond", + "millisecond", + "second", + "minute", + "hour", "day", "week", "month", @@ -677,11 +689,23 @@ }, "grain": { "enum": [ + "NANOSECOND", + "MICROSECOND", + "MILLISECOND", + "SECOND", + "MINUTE", + "HOUR", "DAY", "WEEK", "MONTH", "QUARTER", "YEAR", + "nanosecond", + "microsecond", + "millisecond", + "second", + "minute", + "hour", "day", "week", "month", diff --git a/dbt_semantic_interfaces/parsing/schemas.py b/dbt_semantic_interfaces/parsing/schemas.py index dcc0a1cf..78a60f3e 100644 --- a/dbt_semantic_interfaces/parsing/schemas.py +++ b/dbt_semantic_interfaces/parsing/schemas.py @@ -34,7 +34,19 @@ window_aggregation_type_values = ["MIN", "MAX"] window_aggregation_type_values += [x.lower() for x in window_aggregation_type_values] -time_granularity_values = ["DAY", "WEEK", "MONTH", "QUARTER", "YEAR"] +time_granularity_values = [ + "NANOSECOND", + "MICROSECOND", + "MILLISECOND", + "SECOND", + "MINUTE", + "HOUR", + "DAY", + "WEEK", + "MONTH", + "QUARTER", + "YEAR", +] time_granularity_values += [x.lower() for x in time_granularity_values] dimension_type_values = ["CATEGORICAL", "TIME"] diff --git a/tests/fixtures/semantic_manifest_yamls/simple_semantic_manifest/semantic_models/id_verifications.yaml b/tests/fixtures/semantic_manifest_yamls/simple_semantic_manifest/semantic_models/id_verifications.yaml index e6303afe..1fb9b4f5 100644 --- a/tests/fixtures/semantic_manifest_yamls/simple_semantic_manifest/semantic_models/id_verifications.yaml +++ b/tests/fixtures/semantic_manifest_yamls/simple_semantic_manifest/semantic_models/id_verifications.yaml @@ -19,7 +19,7 @@ semantic_model: - name: ds type: time type_params: - time_granularity: day + time_granularity: second - name: ds_partitioned type: time is_partition: true From a891657923ef125779471c0402861971d0384a2c Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Thu, 6 Jun 2024 19:02:05 -0700 Subject: [PATCH 2/2] Changelog --- .changes/unreleased/Features-20240606-190154.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Features-20240606-190154.yaml diff --git a/.changes/unreleased/Features-20240606-190154.yaml b/.changes/unreleased/Features-20240606-190154.yaml new file mode 100644 index 00000000..f3a76927 --- /dev/null +++ b/.changes/unreleased/Features-20240606-190154.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Enable sub-daily granularity in YAML wherever TimeGranularity is supported. +time: 2024-06-06T19:01:54.71895-07:00 +custom: + Author: courtneyholcomb + Issue: "818"