Skip to content

Commit

Permalink
Integratoin test
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Jan 26, 2024
1 parent fc78da5 commit 98597ef
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,31 @@ integration_test:
GROUP BY
subq_3.metric_time__month
ORDER BY subq_3.metric_time__month
---
integration_test:
name: cumulative_metric_with_agg_time_dimension
description: Query a cumulative metric with its agg_time_dimension and a time constraint.
model: SIMPLE_MODEL
metrics: ["trailing_2_months_revenue"]
group_bys: ["revenue_instance__ds__day"]
order_bys: ["revenue_instance__ds__day"]
where_filter: '{{ render_time_constraint("revenue_instance__ds__day", "2020-03-05", "2021-01-04") }}'
check_query: |
SELECT
SUM(b.txn_revenue) as trailing_2_months_revenue
, a.ds AS revenue_instance__ds__day
FROM (
SELECT ds
FROM {{ mf_time_spine_source }}
WHERE {{ render_time_constraint("ds", "2020-01-05", "2021-01-04") }}
) a
INNER JOIN (
SELECT
revenue as txn_revenue
, created_at AS ds
FROM {{ source_schema }}.fct_revenue
) b
ON b.ds <= a.ds AND b.ds > {{ render_date_sub("a", "ds", 2, TimeGranularity.MONTH) }}
WHERE {{ render_time_constraint("a.ds", "2020-03-05", "2021-01-04") }}
GROUP BY a.ds
ORDER BY a.ds

0 comments on commit 98597ef

Please sign in to comment.