Skip to content

Commit

Permalink
WIP - time spine config
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Jun 16, 2024
1 parent ee52b13 commit 7ceff59
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dbt_semantic_interfaces/protocols/project_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 17 additions & 9 deletions dbt_semantic_interfaces/protocols/time_spine_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,39 @@
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:
...
2020-01-01
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

0 comments on commit 7ceff59

Please sign in to comment.