Skip to content

Commit

Permalink
Merge branch 'main' into court/coalesce-for-multiple-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Nov 6, 2023
2 parents c8bcbd2 + 6789470 commit 60544fb
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Breaking Changes-20231106-090301.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Breaking Changes
body: Update Dependencies to Use `dbt-semantic-interfaces~=0.4.0`
time: 2023-11-06T09:03:01.474125-08:00
custom:
Author: plypaul
Issue: "846"
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#

# Controls the number of parallel workers running tests. Try "make -e PARALLELISM=4 test".
PARALLELISM = "auto"
PARALLELISM = auto
# Additional command line options to pass to pytest.
ADDITIONAL_PYTEST_OPTIONS = ""
ADDITIONAL_PYTEST_OPTIONS =

# Pytest that can populate the persistent source schema
USE_PERSISTENT_SOURCE_SCHEMA = "--use-persistent-source-schema"
POPULATE_PERSISTENT_SOURCE_SCHEMA = "metricflow/test/source_schema_tools.py::populate_source_schema"
USE_PERSISTENT_SOURCE_SCHEMA = --use-persistent-source-schema
POPULATE_PERSISTENT_SOURCE_SCHEMA = metricflow/test/source_schema_tools.py::populate_source_schema

# Install Hatch package / project manager
.PHONY: install-hatch
Expand Down Expand Up @@ -78,3 +78,8 @@ postgresql postgres:
.PHONY: regenerate-test-snapshots
regenerate-test-snapshots:
hatch -v run dev-env:python metricflow/test/generate_snapshots.py

# Re-generate snapshots for the default SQL engine.
.PHONY: test-snap
test-snap:
make test ADDITIONAL_PYTEST_OPTIONS=--overwrite-snapshots
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"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = [
"PyYAML~=6.0",
"click>=7.1.2",
"dbt-core~=1.7.0rc1",
"dbt-semantic-interfaces~=0.3.0",
"dbt-semantic-interfaces~=0.4.0",
"graphviz>=0.18.2, <0.21",
"halo~=0.0.31",
"more-itertools>=8.10.0, <10.2.0",
Expand Down

0 comments on commit 60544fb

Please sign in to comment.