Skip to content

Commit

Permalink
Fix where filter object inheritance (#771)
Browse files Browse the repository at this point in the history
* fixed where filter object inheritance

* changie

* format updates
  • Loading branch information
DevonFulcher authored Sep 15, 2023
1 parent 87ee477 commit 9daaeb2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20230912-161509.yaml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 3 additions & 11 deletions metricflow/specs/where_filter_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 3 additions & 11 deletions metricflow/specs/where_filter_time_dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9daaeb2

Please sign in to comment.