Skip to content

Commit

Permalink
Add query output test
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Nov 5, 2024
1 parent 934a3e3 commit bc04559
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,28 @@ def test_join_to_time_spine_with_filter_not_in_group_by_using_agg_time_and_metri
snapshot_str=query_result.result_df.text_format(),
sql_engine=sql_client.sql_engine_type,
)


@pytest.mark.sql_engine_snapshot
def test_join_to_time_spine_with_custom_grain_in_group_by( # noqa: D103
request: FixtureRequest,
mf_test_configuration: MetricFlowTestConfiguration,
sql_client: SqlClient,
it_helpers: IntegrationTestHelpers,
) -> None:
query_result = it_helpers.mf_engine.query(
MetricFlowQueryRequest.create_with_random_request_id(
metric_names=["bookings_join_to_time_spine"],
group_by_names=["booking__ds__martian_day"],
order_by_names=["booking__ds__martian_day"],
)
)
assert query_result.result_df is not None, "Unexpected empty result."

assert_str_snapshot_equal(
request=request,
mf_test_configuration=mf_test_configuration,
snapshot_id="query_output",
snapshot_str=query_result.result_df.text_format(),
sql_engine=sql_client.sql_engine_type,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
booking__ds__martian_day bookings_join_to_time_spine
-------------------------- -----------------------------
2020-01-01T00:00:00 None
2020-01-02T00:00:00 None
2020-01-03T00:00:00 None
2020-01-04T00:00:00 None
2020-01-05T00:00:00 None
2020-01-06T00:00:00 None
2020-01-07T00:00:00 None
2020-01-08T00:00:00 46
2020-01-09T00:00:00 None
2020-01-10T00:00:00 None
2020-01-11T00:00:00 None
2020-01-12T00:00:00 None
2020-01-13T00:00:00 None
2020-01-14T00:00:00 None
2020-01-15T00:00:00 None
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
booking__ds__martian_day bookings_join_to_time_spine
-------------------------- -----------------------------
2020-01-01T00:00:00 None
2020-01-02T00:00:00 None
2020-01-03T00:00:00 None
2020-01-04T00:00:00 None
2020-01-05T00:00:00 None
2020-01-06T00:00:00 None
2020-01-07T00:00:00 None
2020-01-08T00:00:00 46
2020-01-09T00:00:00 None
2020-01-10T00:00:00 None
2020-01-11T00:00:00 None
2020-01-12T00:00:00 None
2020-01-13T00:00:00 None
2020-01-14T00:00:00 None
2020-01-15T00:00:00 None
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
booking__ds__martian_day bookings_join_to_time_spine
-------------------------- -----------------------------
2020-01-01T00:00:00 None
2020-01-02T00:00:00 None
2020-01-03T00:00:00 None
2020-01-04T00:00:00 None
2020-01-05T00:00:00 None
2020-01-06T00:00:00 None
2020-01-07T00:00:00 None
2020-01-08T00:00:00 46
2020-01-09T00:00:00 None
2020-01-10T00:00:00 None
2020-01-11T00:00:00 None
2020-01-12T00:00:00 None
2020-01-13T00:00:00 None
2020-01-14T00:00:00 None
2020-01-15T00:00:00 None
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
booking__ds__martian_day bookings_join_to_time_spine
-------------------------- -----------------------------
2020-01-01T00:00:00 None
2020-01-02T00:00:00 None
2020-01-03T00:00:00 None
2020-01-04T00:00:00 None
2020-01-05T00:00:00 None
2020-01-06T00:00:00 None
2020-01-07T00:00:00 None
2020-01-08T00:00:00 46
2020-01-09T00:00:00 None
2020-01-10T00:00:00 None
2020-01-11T00:00:00 None
2020-01-12T00:00:00 None
2020-01-13T00:00:00 None
2020-01-14T00:00:00 None
2020-01-15T00:00:00 None
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
booking__ds__martian_day bookings_join_to_time_spine
-------------------------- -----------------------------
2020-01-01T00:00:00 None
2020-01-02T00:00:00 None
2020-01-03T00:00:00 None
2020-01-04T00:00:00 None
2020-01-05T00:00:00 None
2020-01-06T00:00:00 None
2020-01-07T00:00:00 None
2020-01-08T00:00:00 46
2020-01-09T00:00:00 None
2020-01-10T00:00:00 None
2020-01-11T00:00:00 None
2020-01-12T00:00:00 None
2020-01-13T00:00:00 None
2020-01-14T00:00:00 None
2020-01-15T00:00:00 None
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
BOOKING__DS__MARTIAN_DAY BOOKINGS_JOIN_TO_TIME_SPINE
-------------------------- -----------------------------
2020-01-01T00:00:00 None
2020-01-02T00:00:00 None
2020-01-03T00:00:00 None
2020-01-04T00:00:00 None
2020-01-05T00:00:00 None
2020-01-06T00:00:00 None
2020-01-07T00:00:00 None
2020-01-08T00:00:00 46
2020-01-09T00:00:00 None
2020-01-10T00:00:00 None
2020-01-11T00:00:00 None
2020-01-12T00:00:00 None
2020-01-13T00:00:00 None
2020-01-14T00:00:00 None
2020-01-15T00:00:00 None
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
booking__ds__martian_day bookings_join_to_time_spine
-------------------------- -----------------------------
2020-01-01T00:00:00 None
2020-01-02T00:00:00 None
2020-01-03T00:00:00 None
2020-01-04T00:00:00 None
2020-01-05T00:00:00 None
2020-01-06T00:00:00 None
2020-01-07T00:00:00 None
2020-01-08T00:00:00 46
2020-01-09T00:00:00 None
2020-01-10T00:00:00 None
2020-01-11T00:00:00 None
2020-01-12T00:00:00 None
2020-01-13T00:00:00 None
2020-01-14T00:00:00 None
2020-01-15T00:00:00 None

0 comments on commit bc04559

Please sign in to comment.