Skip to content

Commit

Permalink
Changes as required by dbt-semantic-interfaces~=0.4.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed Nov 6, 2023
1 parent dd2b0f1 commit 4b94b5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
9 changes: 5 additions & 4 deletions metricflow/query/query_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,16 @@ def parse_and_validate_saved_query(

# Merge interface could streamline this.
where_filters: List[WhereFilter] = []
if saved_query.where is not None:
where_filters.extend(saved_query.where.where_filters)
if saved_query.query_params.where is not None:
where_filters.extend(saved_query.query_params.where.where_filters)
if where_filter is not None:
where_filters.append(where_filter)

return self.parse_and_validate_query(
metrics=tuple(MetricParameter(name=metric_name) for metric_name in saved_query.metrics),
metrics=tuple(MetricParameter(name=metric_name) for metric_name in saved_query.query_params.metrics),
group_by=tuple(
parse_object_builder_naming_scheme(group_by_item_name) for group_by_item_name in saved_query.group_bys
parse_object_builder_naming_scheme(group_by_item_name)
for group_by_item_name in saved_query.query_params.group_by
),
where_constraint=merge_to_single_where_filter(PydanticWhereFilterIntersection(where_filters=where_filters)),
limit=limit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
saved_query:
name: p0_booking
description: Booking-related metrics that are of the highest priority.
metrics:
- bookings
- instant_bookings
group_bys:
- TimeDimension('metric_time', 'day')
- Dimension('listing__capacity_latest')
where:
- "{{ Dimension('listing__capacity_latest') }} > 3"
query_params:
metrics:
- bookings
- instant_bookings
group_by:
- TimeDimension('metric_time', 'day')
- Dimension('listing__capacity_latest')
where:
- "{{ Dimension('listing__capacity_latest') }} > 3"

0 comments on commit 4b94b5b

Please sign in to comment.