Skip to content

Commit

Permalink
Add SQL test
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Nov 16, 2023
1 parent 1b0acca commit 91699a5
Show file tree
Hide file tree
Showing 5 changed files with 2,304 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ metric:
---
metric:
name: booking_fees_since_start_of_month
description: nested derived metric with offset
description: nested derived metric with offset and multiple input metrics
type: derived
type_params:
expr: booking_fees - booking_fees_start_of_month
Expand Down
25 changes: 25 additions & 0 deletions metricflow/test/plan_conversion/test_dataflow_to_sql_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,3 +1064,28 @@ def test_nested_offsets( # noqa: D
sql_client=sql_client,
node=dataflow_plan.sink_output_nodes[0].parent_node,
)


@pytest.mark.sql_engine_snapshot
def test_nested_derived_metric_with_offset_multiple_input_metrics( # noqa: D
request: FixtureRequest,
mf_test_session_state: MetricFlowTestSessionState,
dataflow_plan_builder: DataflowPlanBuilder,
dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter,
sql_client: SqlClient,
create_source_tables: bool,
) -> None:
dataflow_plan = dataflow_plan_builder.build_plan(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name="booking_fees_since_start_of_month"),),
time_dimension_specs=(MTD_SPEC_DAY,),
)
)

convert_and_check(
request=request,
mf_test_session_state=mf_test_session_state,
dataflow_to_sql_converter=dataflow_to_sql_converter,
sql_client=sql_client,
node=dataflow_plan.sink_output_nodes[0].parent_node,
)
Loading

0 comments on commit 91699a5

Please sign in to comment.