From d8043dd7fc40494ebe69b009c9c4bb9a10ac024a Mon Sep 17 00:00:00 2001 From: Devon Fulcher Date: Tue, 12 Sep 2023 10:33:51 -0500 Subject: [PATCH 1/3] fixed where filter object inheritance --- metricflow/specs/query_interface.py | 1 + metricflow/specs/where_filter_entity.py | 14 +++----------- metricflow/specs/where_filter_time_dimension.py | 14 +++----------- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/metricflow/specs/query_interface.py b/metricflow/specs/query_interface.py index ee55a52086..985d844ecf 100644 --- a/metricflow/specs/query_interface.py +++ b/metricflow/specs/query_interface.py @@ -28,6 +28,7 @@ def grain(self) -> Optional[TimeGranularity]: raise NotImplementedError + class QueryInterfaceDimension(Protocol): """Represents the interface for Dimension in the query interface.""" diff --git a/metricflow/specs/where_filter_entity.py b/metricflow/specs/where_filter_entity.py index 5631fb669e..83c983fd39 100644 --- a/metricflow/specs/where_filter_entity.py +++ b/metricflow/specs/where_filter_entity.py @@ -12,28 +12,20 @@ from typing_extensions import override from metricflow.specs.column_assoc import ColumnAssociationResolver -from metricflow.specs.query_interface import QueryInterfaceDimension, QueryInterfaceEntityFactory +from metricflow.specs.query_interface import QueryInterfaceEntity, QueryInterfaceEntityFactory from metricflow.specs.specs import EntitySpec -class WhereFilterEntity(ProtocolHint[QueryInterfaceDimension]): +class WhereFilterEntity(ProtocolHint[QueryInterfaceEntity]): """An entity that is passed in through the where filter parameter.""" @override - def _implements_protocol(self) -> QueryInterfaceDimension: + def _implements_protocol(self) -> QueryInterfaceEntity: return self def __init__(self, column_name: str): # noqa self.column_name = column_name - def grain(self, _grain: str) -> WhereFilterEntity: - """The time granularity.""" - raise NotImplementedError - - def alias(self, _alias: str) -> WhereFilterEntity: - """Renaming the column.""" - raise NotImplementedError - def __str__(self) -> str: """Returns the column name. diff --git a/metricflow/specs/where_filter_time_dimension.py b/metricflow/specs/where_filter_time_dimension.py index 18ed235a81..9ad0bb1826 100644 --- a/metricflow/specs/where_filter_time_dimension.py +++ b/metricflow/specs/where_filter_time_dimension.py @@ -10,28 +10,20 @@ from typing_extensions import override from metricflow.specs.column_assoc import ColumnAssociationResolver -from metricflow.specs.query_interface import QueryInterfaceDimension, QueryInterfaceTimeDimensionFactory +from metricflow.specs.query_interface import QueryInterfaceTimeDimension, QueryInterfaceTimeDimensionFactory from metricflow.specs.specs import TimeDimensionSpec -class WhereFilterTimeDimension(ProtocolHint[QueryInterfaceDimension]): +class WhereFilterTimeDimension(ProtocolHint[QueryInterfaceTimeDimension]): """A time dimension that is passed in through the where filter parameter.""" @override - def _implements_protocol(self) -> QueryInterfaceDimension: + def _implements_protocol(self) -> QueryInterfaceTimeDimension: return self def __init__(self, column_name: str): # noqa self.column_name = column_name - def grain(self, _grain: str) -> WhereFilterTimeDimension: - """The time granularity.""" - raise NotImplementedError - - def alias(self, _alias: str) -> WhereFilterTimeDimension: - """Renaming the column.""" - raise NotImplementedError - def __str__(self) -> str: """Returns the column name. From faeaca823eed55137ce96c09eb03c787f5d43401 Mon Sep 17 00:00:00 2001 From: Devon Fulcher Date: Tue, 12 Sep 2023 16:15:16 -0500 Subject: [PATCH 2/3] changie --- .changes/unreleased/Under the Hood-20230912-161509.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Under the Hood-20230912-161509.yaml diff --git a/.changes/unreleased/Under the Hood-20230912-161509.yaml b/.changes/unreleased/Under the Hood-20230912-161509.yaml new file mode 100644 index 0000000000..369456bcc4 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230912-161509.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: A simple update to make the where filter query parameter objects more accurate +time: 2023-09-12T16:15:09.057779-05:00 +custom: + Author: DevonFulcher + Issue: None From 97ed36d27d1f2f072649370f9067ea50d938cb0a Mon Sep 17 00:00:00 2001 From: Devon Fulcher Date: Wed, 13 Sep 2023 13:50:26 -0500 Subject: [PATCH 3/3] format updates --- metricflow/specs/query_interface.py | 1 - 1 file changed, 1 deletion(-) diff --git a/metricflow/specs/query_interface.py b/metricflow/specs/query_interface.py index 985d844ecf..ee55a52086 100644 --- a/metricflow/specs/query_interface.py +++ b/metricflow/specs/query_interface.py @@ -28,7 +28,6 @@ def grain(self) -> Optional[TimeGranularity]: raise NotImplementedError - class QueryInterfaceDimension(Protocol): """Represents the interface for Dimension in the query interface."""