Skip to content

Commit

Permalink
removed raise NotImplementedError in protocol. added abstractmethod d…
Browse files Browse the repository at this point in the history
…ecorator
  • Loading branch information
DevonFulcher committed Sep 19, 2023
1 parent 1c7b68a commit 584ef92
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions dbt_semantic_interfaces/protocols/query_interface.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
from __future__ import annotations
from abc import abstractmethod

from typing import Protocol, Sequence


class QueryInterfaceDimension(Protocol):
"""Represents the interface for Dimension in the query interface."""

@abstractmethod
def grain(self, _grain: str) -> QueryInterfaceDimension:
"""The time granularity."""
raise NotImplementedError
pass

@abstractmethod
def alias(self, _alias: str) -> QueryInterfaceDimension:
"""Renaming the column."""
raise NotImplementedError
pass


class QueryInterfaceDimensionFactory(Protocol):
Expand All @@ -21,9 +24,10 @@ class QueryInterfaceDimensionFactory(Protocol):
Represented as the Dimension constructor in the Jinja sandbox.
"""

@abstractmethod
def create(self, name: str, entity_path: Sequence[str] = ()) -> QueryInterfaceDimension:
"""Create a QueryInterfaceDimension."""
raise NotImplementedError
pass


class QueryInterfaceTimeDimension(Protocol):
Expand All @@ -38,14 +42,15 @@ class QueryInterfaceTimeDimensionFactory(Protocol):
Represented as the TimeDimension constructor in the Jinja sandbox.
"""

@abstractmethod
def create(
self,
time_dimension_name: str,
time_granularity_name: str,
entity_path: Sequence[str] = (),
) -> QueryInterfaceTimeDimension:
"""Create a TimeDimension."""
raise NotImplementedError
pass


class QueryInterfaceEntity(Protocol):
Expand All @@ -60,6 +65,7 @@ class QueryInterfaceEntityFactory(Protocol):
Represented as the Entity constructor in the Jinja sandbox.
"""

@abstractmethod
def create(self, entity_name: str, entity_path: Sequence[str] = ()) -> QueryInterfaceEntity:
"""Create an Entity."""
raise NotImplementedError
pass

0 comments on commit 584ef92

Please sign in to comment.