From cf013c5107b07b5e071e604c3bcfbb8283bfdac2 Mon Sep 17 00:00:00 2001 From: Devon Fulcher Date: Wed, 4 Oct 2023 10:58:26 -0500 Subject: [PATCH] removed query interface --- metricflow/protocols/query_interface.py | 87 ------------------- metricflow/specs/where_filter_dimension.py | 8 +- metricflow/specs/where_filter_entity.py | 2 +- .../specs/where_filter_time_dimension.py | 4 +- 4 files changed, 7 insertions(+), 94 deletions(-) delete mode 100644 metricflow/protocols/query_interface.py 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