Skip to content

Commit

Permalink
Update SQL engine snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Jun 12, 2024
1 parent 71ba4b1 commit 24693c0
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 132 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
-- Compute Metrics via Expressions
SELECT
subq_10.metric_time__month
subq_10.metric_time__day
, subq_10.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
subq_9.metric_time__month
subq_9.metric_time__day
, SUM(subq_9.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
subq_8.metric_time__month
subq_8.metric_time__day
, subq_8.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
SELECT
subq_7.metric_time__month
subq_7.metric_time__day
, subq_7.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
subq_5.metric_time__month AS metric_time__month
subq_5.metric_time__day AS metric_time__day
, subq_4.ds__day AS ds__day
, subq_4.ds__week AS ds__week
, subq_4.ds__month AS ds__month
Expand All @@ -43,8 +43,8 @@ FROM (
, subq_4.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
, subq_4.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
, subq_4.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
, subq_4.metric_time__day AS metric_time__day
, subq_4.metric_time__week AS metric_time__week
, subq_4.metric_time__month AS metric_time__month
, subq_4.metric_time__quarter AS metric_time__quarter
, subq_4.metric_time__year AS metric_time__year
, subq_4.metric_time__extract_year AS metric_time__extract_year
Expand All @@ -59,11 +59,9 @@ FROM (
FROM (
-- Time Spine
SELECT
DATETIME_TRUNC(subq_6.ds, month) AS metric_time__month
subq_6.ds AS metric_time__day
FROM ***************************.mf_time_spine subq_6
WHERE subq_6.ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
metric_time__month
) subq_5
INNER JOIN (
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
Expand Down Expand Up @@ -177,11 +175,11 @@ FROM (
WHERE subq_3.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
) subq_4
ON
(subq_4.metric_time__month <= subq_5.metric_time__month)
(subq_4.metric_time__day <= subq_5.metric_time__day)
) subq_7
) subq_8
WHERE subq_8.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
WHERE subq_8.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
) subq_9
GROUP BY
metric_time__month
metric_time__day
) subq_10
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
-- Join Self Over Time Range
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
subq_14.metric_time__month AS metric_time__month
subq_14.metric_time__day AS metric_time__day
, SUM(subq_13.txn_revenue) AS revenue_all_time
FROM (
-- Time Spine
SELECT
DATETIME_TRUNC(ds, month) AS metric_time__month
ds AS metric_time__day
FROM ***************************.mf_time_spine subq_15
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
metric_time__month
) subq_14
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
DATETIME_TRUNC(created_at, month) AS metric_time__month
DATETIME_TRUNC(created_at, day) AS metric_time__day
, revenue AS txn_revenue
FROM ***************************.fct_revenue revenue_src_28000
WHERE DATETIME_TRUNC(created_at, day) BETWEEN '2000-01-01' AND '2020-01-01'
) subq_13
ON
(subq_13.metric_time__month <= subq_14.metric_time__month)
WHERE subq_14.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
(subq_13.metric_time__day <= subq_14.metric_time__day)
WHERE subq_14.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
metric_time__month
metric_time__day
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
-- Compute Metrics via Expressions
SELECT
subq_10.metric_time__month
subq_10.metric_time__day
, subq_10.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
subq_9.metric_time__month
subq_9.metric_time__day
, SUM(subq_9.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
subq_8.metric_time__month
subq_8.metric_time__day
, subq_8.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
SELECT
subq_7.metric_time__month
subq_7.metric_time__day
, subq_7.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
subq_5.metric_time__month AS metric_time__month
subq_5.metric_time__day AS metric_time__day
, subq_4.ds__day AS ds__day
, subq_4.ds__week AS ds__week
, subq_4.ds__month AS ds__month
Expand All @@ -43,8 +43,8 @@ FROM (
, subq_4.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
, subq_4.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
, subq_4.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
, subq_4.metric_time__day AS metric_time__day
, subq_4.metric_time__week AS metric_time__week
, subq_4.metric_time__month AS metric_time__month
, subq_4.metric_time__quarter AS metric_time__quarter
, subq_4.metric_time__year AS metric_time__year
, subq_4.metric_time__extract_year AS metric_time__extract_year
Expand All @@ -59,11 +59,9 @@ FROM (
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', subq_6.ds) AS metric_time__month
subq_6.ds AS metric_time__day
FROM ***************************.mf_time_spine subq_6
WHERE subq_6.ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
DATE_TRUNC('month', subq_6.ds)
) subq_5
INNER JOIN (
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
Expand Down Expand Up @@ -177,11 +175,11 @@ FROM (
WHERE subq_3.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
) subq_4
ON
(subq_4.metric_time__month <= subq_5.metric_time__month)
(subq_4.metric_time__day <= subq_5.metric_time__day)
) subq_7
) subq_8
WHERE subq_8.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
WHERE subq_8.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
) subq_9
GROUP BY
subq_9.metric_time__month
subq_9.metric_time__day
) subq_10
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
-- Join Self Over Time Range
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
subq_14.metric_time__month AS metric_time__month
subq_14.metric_time__day AS metric_time__day
, SUM(subq_13.txn_revenue) AS revenue_all_time
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
ds AS metric_time__day
FROM ***************************.mf_time_spine subq_15
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
DATE_TRUNC('month', ds)
) subq_14
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
DATE_TRUNC('month', created_at) AS metric_time__month
DATE_TRUNC('day', created_at) AS metric_time__day
, revenue AS txn_revenue
FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01'
) subq_13
ON
(subq_13.metric_time__month <= subq_14.metric_time__month)
WHERE subq_14.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
(subq_13.metric_time__day <= subq_14.metric_time__day)
WHERE subq_14.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
subq_14.metric_time__month
subq_14.metric_time__day
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
-- Compute Metrics via Expressions
SELECT
subq_10.metric_time__month
subq_10.metric_time__day
, subq_10.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
subq_9.metric_time__month
subq_9.metric_time__day
, SUM(subq_9.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
subq_8.metric_time__month
subq_8.metric_time__day
, subq_8.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
SELECT
subq_7.metric_time__month
subq_7.metric_time__day
, subq_7.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
subq_5.metric_time__month AS metric_time__month
subq_5.metric_time__day AS metric_time__day
, subq_4.ds__day AS ds__day
, subq_4.ds__week AS ds__week
, subq_4.ds__month AS ds__month
Expand All @@ -43,8 +43,8 @@ FROM (
, subq_4.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
, subq_4.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
, subq_4.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
, subq_4.metric_time__day AS metric_time__day
, subq_4.metric_time__week AS metric_time__week
, subq_4.metric_time__month AS metric_time__month
, subq_4.metric_time__quarter AS metric_time__quarter
, subq_4.metric_time__year AS metric_time__year
, subq_4.metric_time__extract_year AS metric_time__extract_year
Expand All @@ -59,11 +59,9 @@ FROM (
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', subq_6.ds) AS metric_time__month
subq_6.ds AS metric_time__day
FROM ***************************.mf_time_spine subq_6
WHERE subq_6.ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
DATE_TRUNC('month', subq_6.ds)
) subq_5
INNER JOIN (
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
Expand Down Expand Up @@ -177,11 +175,11 @@ FROM (
WHERE subq_3.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
) subq_4
ON
(subq_4.metric_time__month <= subq_5.metric_time__month)
(subq_4.metric_time__day <= subq_5.metric_time__day)
) subq_7
) subq_8
WHERE subq_8.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
WHERE subq_8.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
) subq_9
GROUP BY
subq_9.metric_time__month
subq_9.metric_time__day
) subq_10
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
-- Join Self Over Time Range
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
subq_14.metric_time__month AS metric_time__month
subq_14.metric_time__day AS metric_time__day
, SUM(subq_13.txn_revenue) AS revenue_all_time
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
ds AS metric_time__day
FROM ***************************.mf_time_spine subq_15
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
DATE_TRUNC('month', ds)
) subq_14
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
DATE_TRUNC('month', created_at) AS metric_time__month
DATE_TRUNC('day', created_at) AS metric_time__day
, revenue AS txn_revenue
FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01'
) subq_13
ON
(subq_13.metric_time__month <= subq_14.metric_time__month)
WHERE subq_14.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
(subq_13.metric_time__day <= subq_14.metric_time__day)
WHERE subq_14.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
subq_14.metric_time__month
subq_14.metric_time__day
Loading

0 comments on commit 24693c0

Please sign in to comment.