Skip to content

Commit

Permalink
Bug fix: CLI saved queries dropping order_by_names param (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb authored Nov 2, 2023
1 parent 29e06ea commit 0104913
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 38 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20231102-141010.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: The --order param was being dropped from CLI saved queries.
time: 2023-11-02T14:10:10.028618-07:00
custom:
Author: courtneyholcomb
Issue: "835"
1 change: 1 addition & 0 deletions metricflow/engine/metricflow_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ def _create_execution_plan(self, mf_query_request: MetricFlowQueryRequest) -> Me
else None
),
limit=mf_query_request.limit,
order_by_names=mf_query_request.order_by_names,
order_by_parameters=mf_query_request.order_by,
)
else:
Expand Down
2 changes: 2 additions & 0 deletions metricflow/query/query_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def parse_and_validate_saved_query(
saved_query_parameter: SavedQueryParameter,
where_filter: Optional[WhereFilter],
limit: Optional[int],
order_by_names: Optional[Sequence[str]],
order_by_parameters: Optional[Sequence[OrderByQueryParameter]],
) -> MetricFlowQuerySpec:
"""Parse and validate a query using parameters from a pre-defined / saved query.
Expand All @@ -210,6 +211,7 @@ def parse_and_validate_saved_query(
),
where_constraint=merge_to_single_where_filter(PydanticWhereFilterIntersection(where_filters=where_filters)),
limit=limit,
order_by_names=order_by_names,
order_by=order_by_parameters,
)

Expand Down
2 changes: 1 addition & 1 deletion metricflow/test/generate_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def run_tests(test_configuration: MetricFlowTestConfiguration) -> None: # noqa:
f"hatch -v run {hatch_env}:pytest -x -vv -n 4 "
f"--overwrite-snapshots"
f"{' --use-persistent-source-schema' if use_persistent_source_schema else ''}"
f"-m '{SQL_ENGINE_SNAPSHOT_MARKER_NAME}' "
f" -m '{SQL_ENGINE_SNAPSHOT_MARKER_NAME}' "
f"{TEST_DIRECTORY}"
)
else:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------|---------------------------:|-----------:|-------------------:|
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2020-01-01 00:00:00 | 4 | 2 | 1 |
| 2020-01-02 00:00:00 | 4 | 3 | 3 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2019-12-18 00:00:00 | 4 | 4 | 2 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
| 2019-12-19 00:00:00 | 4 | 6 | 6 |
| 2019-12-19 00:00:00 | 5 | 2 | 0 |
| 2019-12-20 00:00:00 | 5 | 2 | 0 |
| 2020-01-01 00:00:00 | 4 | 2 | 1 |
| 2020-01-02 00:00:00 | 4 | 3 | 3 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------|---------------------------:|-----------:|-------------------:|
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2020-01-01 00:00:00 | 4 | 2 | 1 |
| 2020-01-02 00:00:00 | 4 | 3 | 3 |
| 2019-12-18 00:00:00 | 4 | 4 | 2 |
| 2019-12-19 00:00:00 | 4 | 6 | 6 |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------|---------------------------:|-----------:|-------------------:|
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
| 2019-12-19 00:00:00 | 5 | 2 | 0 |
| 2019-12-20 00:00:00 | 5 | 2 | 0 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------------|---------------------------:|-----------:|-------------------:|
| 2020-01-02 00:00:00+00:00 | 5 | 1 | 0 |
| 2019-12-19 00:00:00+00:00 | 4 | 6 | 6 |
| 2019-12-01 00:00:00+00:00 | 5 | 1 | 0 |
| 2019-12-20 00:00:00+00:00 | 5 | 2 | 0 |
| 2019-12-19 00:00:00+00:00 | 5 | 2 | 0 |
| 2019-12-18 00:00:00+00:00 | 4 | 4 | 2 |
| 2019-12-19 00:00:00+00:00 | 4 | 6 | 6 |
| 2019-12-19 00:00:00+00:00 | 5 | 2 | 0 |
| 2019-12-20 00:00:00+00:00 | 5 | 2 | 0 |
| 2020-01-01 00:00:00+00:00 | 4 | 2 | 1 |
| 2020-01-02 00:00:00+00:00 | 4 | 3 | 3 |
| 2020-01-02 00:00:00+00:00 | 5 | 1 | 0 |
| 2020-01-03 00:00:00+00:00 | 5 | 1 | 0 |
| 2020-01-01 00:00:00+00:00 | 4 | 2 | 1 |
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------------|---------------------------:|-----------:|-------------------:|
| 2020-01-02 00:00:00+00:00 | 5 | 1 | 0 |
| 2019-12-19 00:00:00+00:00 | 4 | 6 | 6 |
| 2019-12-01 00:00:00+00:00 | 5 | 1 | 0 |
| 2019-12-18 00:00:00+00:00 | 4 | 4 | 2 |
| 2019-12-19 00:00:00+00:00 | 4 | 6 | 6 |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------------|---------------------------:|-----------:|-------------------:|
| 2020-01-02 00:00:00+00:00 | 5 | 1 | 0 |
| 2019-12-01 00:00:00+00:00 | 5 | 1 | 0 |
| 2019-12-20 00:00:00+00:00 | 5 | 2 | 0 |
| 2019-12-19 00:00:00+00:00 | 5 | 2 | 0 |
| 2019-12-20 00:00:00+00:00 | 5 | 2 | 0 |
| 2020-01-02 00:00:00+00:00 | 5 | 1 | 0 |
| 2020-01-03 00:00:00+00:00 | 5 | 1 | 0 |
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------|---------------------------:|-----------:|-------------------:|
| 2019-12-19 00:00:00 | 4 | 6 | 6 |
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2019-12-18 00:00:00 | 4 | 4 | 2 |
| 2019-12-19 00:00:00 | 4 | 6 | 6 |
| 2019-12-19 00:00:00 | 5 | 2 | 0 |
| 2020-01-02 00:00:00 | 4 | 3 | 3 |
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2019-12-20 00:00:00 | 5 | 2 | 0 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2020-01-01 00:00:00 | 4 | 2 | 1 |
| 2020-01-02 00:00:00 | 4 | 3 | 3 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------|---------------------------:|-----------:|-------------------:|
| 2019-12-19 00:00:00 | 4 | 6 | 6 |
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2019-12-18 00:00:00 | 4 | 4 | 2 |
| 2019-12-19 00:00:00 | 5 | 2 | 0 |
| 2019-12-19 00:00:00 | 4 | 6 | 6 |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------|---------------------------:|-----------:|-------------------:|
| 2019-12-19 00:00:00 | 5 | 2 | 0 |
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2019-12-19 00:00:00 | 5 | 2 | 0 |
| 2019-12-20 00:00:00 | 5 | 2 | 0 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------|---------------------------:|-----------:|-------------------:|
| 2019-12-19 00:00:00 | 5 | 2 | 0 |
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2019-12-18 00:00:00 | 4 | 4 | 2 |
| 2019-12-19 00:00:00 | 4 | 6 | 6 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2019-12-19 00:00:00 | 5 | 2 | 0 |
| 2019-12-20 00:00:00 | 5 | 2 | 0 |
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2020-01-02 00:00:00 | 4 | 3 | 3 |
| 2020-01-01 00:00:00 | 4 | 2 | 1 |
| 2019-12-18 00:00:00 | 4 | 4 | 2 |
| 2020-01-02 00:00:00 | 4 | 3 | 3 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------|---------------------------:|-----------:|-------------------:|
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2019-12-20 00:00:00 | 5 | 2 | 0 |
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2019-12-18 00:00:00 | 4 | 4 | 2 |
| 2019-12-19 00:00:00 | 4 | 6 | 6 |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
| metric_time__day | listing__capacity_latest | bookings | instant_bookings |
|:--------------------|---------------------------:|-----------:|-------------------:|
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2019-12-19 00:00:00 | 5 | 2 | 0 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2019-12-20 00:00:00 | 5 | 2 | 0 |
| 2019-12-01 00:00:00 | 5 | 1 | 0 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
| 2019-12-19 00:00:00 | 5 | 2 | 0 |
| 2019-12-20 00:00:00 | 5 | 2 | 0 |
| 2020-01-01 00:00:00 | 4 | 2 | 1 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2020-01-02 00:00:00 | 4 | 3 | 3 |
| 2020-01-02 00:00:00 | 5 | 1 | 0 |
| 2020-01-03 00:00:00 | 5 | 1 | 0 |

0 comments on commit 0104913

Please sign in to comment.