From 7ceff59696a8b427042dac92c00e3009e0389e0d Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Sun, 16 Jun 2024 09:15:40 -0700 Subject: [PATCH] WIP - time spine config --- .../protocols/project_configuration.py | 2 +- .../protocols/time_spine_configuration.py | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/dbt_semantic_interfaces/protocols/project_configuration.py b/dbt_semantic_interfaces/protocols/project_configuration.py index e2248bb3..b539deb6 100644 --- a/dbt_semantic_interfaces/protocols/project_configuration.py +++ b/dbt_semantic_interfaces/protocols/project_configuration.py @@ -18,6 +18,6 @@ def dsi_package_version(self) -> SemanticVersion: @property @abstractmethod - def time_spine_table_configurations(self) -> Sequence[TimeSpineTableConfiguration]: + def time_spines(self) -> Sequence[TimeSpineTableConfiguration]: """The time spine table configurations. Multiple allowed for different time grains.""" pass diff --git a/dbt_semantic_interfaces/protocols/time_spine_configuration.py b/dbt_semantic_interfaces/protocols/time_spine_configuration.py index de0579a7..fcee7453 100644 --- a/dbt_semantic_interfaces/protocols/time_spine_configuration.py +++ b/dbt_semantic_interfaces/protocols/time_spine_configuration.py @@ -7,7 +7,7 @@ class TimeSpineTableConfiguration(Protocol): """Describes the configuration for a time spine table. - A time spine table is a table with a single column containing dates at a specific grain. + A time spine table is a table with at least one column containing dates at a specific grain. e.g. with day granularity: ... @@ -15,23 +15,31 @@ class TimeSpineTableConfiguration(Protocol): 2020-01-02 2020-01-03 ... - - The time spine table is used to join to the measure source to compute cumulative metrics. """ @property @abstractmethod - def location(self) -> str: - """The location of the time spine table in schema_name.table_name format.""" + def name(self) -> str: + """Name used to reference this time spine.""" pass @property @abstractmethod - def column_name(self) -> str: - """The name of the column in the time spine table that has the date values.""" + def model(self) -> str: + """dbt model that represents the time spine.""" + pass @property @abstractmethod - def grain(self) -> TimeGranularity: - """The grain of the dates in the time spine table.""" + def base_column(self) -> str: + """The name of the column in the time spine table that has the values at the base granularity.""" + pass + + @property + @abstractmethod + def base_granularity(self) -> TimeGranularity: + """The grain of the dates in the base_column. + + Must map to one of the default TimeGranularity values, not a custom granularity. + """ pass