diff --git a/metricflow/protocols/query_interface.py b/metricflow/protocols/query_interface.py deleted file mode 100644 index 2831740ba4..0000000000 --- a/metricflow/protocols/query_interface.py +++ /dev/null @@ -1,87 +0,0 @@ -from __future__ import annotations - -from abc import abstractmethod -from typing import Optional, Protocol, Sequence - - -class QueryInterfaceMetric(Protocol): - """Represents the interface for Metric in the query interface.""" - - @abstractmethod - def descending(self, _is_descending: bool) -> QueryInterfaceMetric: - """Set the sort order for order-by.""" - pass - - -class QueryInterfaceDimension(Protocol): - """Represents the interface for Dimension in the query interface.""" - - @abstractmethod - def grain(self, _grain: str) -> QueryInterfaceDimension: - """The time granularity.""" - pass - - @abstractmethod - def descending(self, _is_descending: bool) -> QueryInterfaceDimension: - """Set the sort order for order-by.""" - pass - - @abstractmethod - def date_part(self, _date_part: str) -> QueryInterfaceDimension: - """Date part to extract from the dimension.""" - pass - - -class QueryInterfaceDimensionFactory(Protocol): - """Creates a Dimension for the query interface. - - Represented as the Dimension constructor in the Jinja sandbox. - """ - - @abstractmethod - def create(self, name: str, entity_path: Sequence[str] = ()) -> QueryInterfaceDimension: - """Create a QueryInterfaceDimension.""" - pass - - -class QueryInterfaceTimeDimension(Protocol): - """Represents the interface for TimeDimension in the query interface.""" - - pass - - -class QueryInterfaceTimeDimensionFactory(Protocol): - """Creates a TimeDimension for the query interface. - - 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] = (), - descending: Optional[bool] = None, - date_part_name: Optional[str] = None, - ) -> QueryInterfaceTimeDimension: - """Create a TimeDimension.""" - pass - - -class QueryInterfaceEntity(Protocol): - """Represents the interface for Entity in the query interface.""" - - pass - - -class QueryInterfaceEntityFactory(Protocol): - """Creates an Entity for the query interface. - - Represented as the Entity constructor in the Jinja sandbox. - """ - - @abstractmethod - def create(self, entity_name: str, entity_path: Sequence[str] = ()) -> QueryInterfaceEntity: - """Create an Entity.""" - pass diff --git a/metricflow/specs/where_filter_dimension.py b/metricflow/specs/where_filter_dimension.py index 8682a1d532..086a6b758c 100644 --- a/metricflow/specs/where_filter_dimension.py +++ b/metricflow/specs/where_filter_dimension.py @@ -5,15 +5,15 @@ from dbt_semantic_interfaces.call_parameter_sets import ( FilterCallParameterSets, ) +from dbt_semantic_interfaces.protocols import ( + QueryInterfaceDimension, + QueryInterfaceDimensionFactory, +) from dbt_semantic_interfaces.protocols.protocol_hint import ProtocolHint from dbt_semantic_interfaces.type_enums import TimeGranularity from typing_extensions import override from metricflow.errors.errors import InvalidQuerySyntax -from metricflow.protocols.query_interface import ( - QueryInterfaceDimension, - QueryInterfaceDimensionFactory, -) from metricflow.specs.column_assoc import ColumnAssociationResolver from metricflow.specs.dimension_spec_resolver import DimensionSpecResolver from metricflow.specs.specs import TimeDimensionSpec diff --git a/metricflow/specs/where_filter_entity.py b/metricflow/specs/where_filter_entity.py index 78af16c458..2991225357 100644 --- a/metricflow/specs/where_filter_entity.py +++ b/metricflow/specs/where_filter_entity.py @@ -7,12 +7,12 @@ FilterCallParameterSets, ) from dbt_semantic_interfaces.naming.dundered import DunderedNameFormatter +from dbt_semantic_interfaces.protocols import QueryInterfaceEntity, QueryInterfaceEntityFactory from dbt_semantic_interfaces.protocols.protocol_hint import ProtocolHint from dbt_semantic_interfaces.references import EntityReference from typing_extensions import override from metricflow.errors.errors import InvalidQuerySyntax -from metricflow.protocols.query_interface import QueryInterfaceEntity, QueryInterfaceEntityFactory from metricflow.specs.column_assoc import ColumnAssociationResolver from metricflow.specs.specs import EntitySpec diff --git a/metricflow/specs/where_filter_time_dimension.py b/metricflow/specs/where_filter_time_dimension.py index 20280b48bc..a7ff272f06 100644 --- a/metricflow/specs/where_filter_time_dimension.py +++ b/metricflow/specs/where_filter_time_dimension.py @@ -4,11 +4,11 @@ from dbt_semantic_interfaces.call_parameter_sets import FilterCallParameterSets from dbt_semantic_interfaces.protocols.protocol_hint import ProtocolHint +from dbt_semantic_interfaces.query_interface import QueryInterfaceTimeDimension, QueryInterfaceTimeDimensionFactory from dbt_semantic_interfaces.type_enums import TimeGranularity from typing_extensions import override -from metricflow.errors.errors import InvalidQuerySyntax -from metricflow.protocols.query_interface import QueryInterfaceTimeDimension, QueryInterfaceTimeDimensionFactory +from metricflow.errors.errors import InvalidQuerySyntax from metricflow.specs.column_assoc import ColumnAssociationResolver from metricflow.specs.dimension_spec_resolver import DimensionSpecResolver from metricflow.specs.specs import TimeDimensionSpec