-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update time spine configs for sub-daily granularity & custom calendar #293
Changes from all commits
59286e0
3056ea5
9c993ad
fdbe40e
9312f66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Support for configuring multiple time spines at different granularities. | ||
time: 2024-06-17T12:47:17.06019-07:00 | ||
custom: | ||
Author: courtneyholcomb | ||
Issue: "280" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from __future__ import annotations | ||
|
||
from typing_extensions import override | ||
|
||
from dbt_semantic_interfaces.implementations.base import ( | ||
HashableBaseModel, | ||
ModelWithMetadataParsing, | ||
) | ||
from dbt_semantic_interfaces.implementations.semantic_model import PydanticNodeRelation | ||
from dbt_semantic_interfaces.protocols import ProtocolHint | ||
from dbt_semantic_interfaces.protocols.time_spine import TimeSpine | ||
from dbt_semantic_interfaces.type_enums import TimeGranularity | ||
|
||
|
||
class PydanticTimeSpine(HashableBaseModel, ModelWithMetadataParsing, ProtocolHint[TimeSpine]): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We import the "old implementaiton" ( |
||
"""Pydantic implementation of TimeSpine.""" | ||
|
||
@override | ||
def _implements_protocol(self) -> TimeSpine: | ||
return self | ||
|
||
name: str | ||
node_relation: PydanticNodeRelation | ||
base_column: str | ||
base_granularity: TimeGranularity |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from abc import abstractmethod | ||
from typing import Protocol | ||
|
||
from dbt_semantic_interfaces.protocols.semantic_model import NodeRelation | ||
from dbt_semantic_interfaces.type_enums import TimeGranularity | ||
|
||
|
||
class TimeSpine(Protocol): | ||
"""Describes the configuration for a time spine table. | ||
|
||
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 | ||
... | ||
""" | ||
|
||
@property | ||
@abstractmethod | ||
def name(self) -> str: | ||
"""Name used to reference this time spine.""" | ||
pass | ||
|
||
@property | ||
@abstractmethod | ||
def node_relation(self) -> NodeRelation: | ||
"""dbt model that represents the time spine.""" # noqa: D403 | ||
pass | ||
|
||
@property | ||
@abstractmethod | ||
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 |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes for this class are not breaking for core