-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0275a8
commit 175672c
Showing
9 changed files
with
162 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from __future__ import annotations | ||
|
||
from typing_extensions import override | ||
|
||
from dbt_semantic_interfaces.implementations.base import HashableBaseModel | ||
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, TimeSpinePrimaryColumn | ||
from dbt_semantic_interfaces.type_enums import TimeGranularity | ||
|
||
|
||
class PydanticTimeSpinePrimaryColumn(HashableBaseModel, ProtocolHint[TimeSpinePrimaryColumn]): | ||
"""Legacy Pydantic implementation of SemanticVersion. In the process of deprecation.""" | ||
|
||
@override | ||
def _implements_protocol(self) -> TimeSpinePrimaryColumn: | ||
return self | ||
|
||
name: str | ||
time_granularity: TimeGranularity | ||
|
||
|
||
class PydanticTimeSpine(HashableBaseModel, ProtocolHint[TimeSpine]): | ||
"""Legacy Pydantic implementation of SemanticVersion. In the process of deprecation.""" | ||
|
||
@override | ||
def _implements_protocol(self) -> TimeSpine: | ||
return self | ||
|
||
name: str | ||
node_relation: PydanticNodeRelation | ||
primary_column: PydanticTimeSpinePrimaryColumn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from __future__ import annotations | ||
|
||
from abc import abstractmethod | ||
from typing import Protocol | ||
|
||
from dbt_semantic_interfaces.implementations.node_relation import NodeRelation | ||
from dbt_semantic_interfaces.type_enums import TimeGranularity | ||
|
||
|
||
class TimeSpine(Protocol): | ||
"""Describes a table that contains dates at a specific time grain. | ||
One column must map to a standard granularity (one of the TimeGranularity enum members). Others might represent | ||
custom granularity columns. Custom granularity columns are not yet implemented. | ||
""" | ||
|
||
@property | ||
@abstractmethod | ||
def name(self) -> str: | ||
"""A name the user assigns to this time spine.""" | ||
pass | ||
|
||
@property | ||
@abstractmethod | ||
def node_relation(self) -> NodeRelation: | ||
"""dbt model where this time spine lives.""" | ||
pass | ||
|
||
@property | ||
@abstractmethod | ||
def primary_column(self) -> TimeSpinePrimaryColumn: | ||
"""The column in the time spine that maps to one of our standard granularities.""" | ||
pass | ||
|
||
|
||
class TimeSpinePrimaryColumn(Protocol): | ||
"""The column in the time spine that maps to one of our standard granularities.""" | ||
|
||
@property | ||
@abstractmethod | ||
def name(self) -> str: | ||
"""The column name.""" | ||
pass | ||
|
||
@property | ||
@abstractmethod | ||
def time_granularity(self) -> TimeGranularity: | ||
"""The column name.""" | ||
pass |
9 changes: 6 additions & 3 deletions
9
...ces/protocols/time_spine_configuration.py → ...rfaces/protocols/time_spine_deprecated.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters