Skip to content

Commit

Permalink
updated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DevonFulcher committed Oct 4, 2023
1 parent 3c97f45 commit 86f14bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions metricflow/specs/where_filter_dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ def grain(self, time_granularity_name: str) -> QueryInterfaceDimension:

def date_part(self, _date_part: str) -> QueryInterfaceDimension:
"""The date_part requested to extract."""
raise InvalidQuerySyntax("date_part isn't currently supported in the where parameter and filter spec")
raise InvalidQuerySyntax("date_part isn't currently supported in the where parameter")

def descending(self, _is_descending: bool) -> QueryInterfaceDimension:
"""Set the sort order for order-by."""
raise InvalidQuerySyntax("descending is invalid in the where parameter and filter spec")
raise InvalidQuerySyntax("descending is invalid in the where parameter")

def __str__(self) -> str:
"""Returns the column name.
Expand Down
6 changes: 5 additions & 1 deletion metricflow/specs/where_filter_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def create_from_where_filter(self, where_filter: WhereFilter) -> WhereFilterSpec
# Used to check that call parameter sets generated by DSI match those generated below.
call_parameter_sets = where_filter.call_parameter_sets

time_dimension_factory = WhereFilterTimeDimensionFactory(call_parameter_sets, self._column_association_resolver)
dimension_factory = WhereFilterDimensionFactory(call_parameter_sets, self._column_association_resolver)
time_dimension_factory = WhereFilterTimeDimensionFactory(call_parameter_sets, self._column_association_resolver)
entity_factory = WhereFilterEntityFactory(call_parameter_sets, self._column_association_resolver)
try:
rendered_sql_template = jinja2.Template(
Expand All @@ -52,6 +52,10 @@ def create_from_where_filter(self, where_filter: WhereFilter) -> WhereFilterSpec
f"Error while rendering Jinja template:\n{where_filter.where_sql_template}"
) from e

"""
Dimensions that are created with a grain parameter, Dimension(...).grain(...), are
added to dimension_specs otherwise they are add to time_dimension_factory.time_dimension_specs
"""
dimension_specs = []
for dimension in dimension_factory.created:
if dimension.time_dimension_spec:
Expand Down

0 comments on commit 86f14bf

Please sign in to comment.