Skip to content

Commit

Permalink
Update snapshots for other SQL engines
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Dec 19, 2024
1 parent 5d66c54 commit eeb0105
Show file tree
Hide file tree
Showing 54 changed files with 807 additions and 423 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ WITH sma_28019_cte AS (
FROM ***************************.fct_visits visits_source_src_28000
)

, rss_28018_cte AS (
-- Read From Time Spine 'mf_time_spine'
SELECT
ds AS ds__day
FROM ***************************.mf_time_spine time_spine_src_28006
)

SELECT
metric_time__day AS metric_time__day
, CAST(buys AS FLOAT64) / CAST(NULLIF(visits, 0) AS FLOAT64) AS visit_buy_conversion_rate_7days_fill_nulls_with_0
Expand All @@ -27,9 +34,9 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_26.visits AS visits
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Read From CTE For node_id=sma_28019
-- Pass Only Elements: ['visits', 'metric_time__day']
Expand All @@ -42,14 +49,14 @@ FROM (
metric_time__day
) subq_26
ON
time_spine_src_28006.ds = subq_26.metric_time__day
rss_28018_cte.ds__day = subq_26.metric_time__day
) subq_30
FULL OUTER JOIN (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_39.buys AS buys
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'metric_time__day']
Expand Down Expand Up @@ -113,7 +120,7 @@ FROM (
metric_time__day
) subq_39
ON
time_spine_src_28006.ds = subq_39.metric_time__day
rss_28018_cte.ds__day = subq_39.metric_time__day
) subq_43
ON
subq_30.metric_time__day = subq_43.metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ WITH sma_28019_cte AS (
FROM ***************************.fct_visits visits_source_src_28000
)

, rss_28018_cte AS (
-- Read From Time Spine 'mf_time_spine'
SELECT
ds AS ds__day
FROM ***************************.mf_time_spine time_spine_src_28006
)

SELECT
metric_time__day AS metric_time__day
, CAST(buys AS DOUBLE) / CAST(NULLIF(visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days_fill_nulls_with_0
Expand All @@ -27,9 +34,9 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_26.visits AS visits
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Read From CTE For node_id=sma_28019
-- Pass Only Elements: ['visits', 'metric_time__day']
Expand All @@ -42,14 +49,14 @@ FROM (
metric_time__day
) subq_26
ON
time_spine_src_28006.ds = subq_26.metric_time__day
rss_28018_cte.ds__day = subq_26.metric_time__day
) subq_30
FULL OUTER JOIN (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_39.buys AS buys
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'metric_time__day']
Expand Down Expand Up @@ -113,7 +120,7 @@ FROM (
metric_time__day
) subq_39
ON
time_spine_src_28006.ds = subq_39.metric_time__day
rss_28018_cte.ds__day = subq_39.metric_time__day
) subq_43
ON
subq_30.metric_time__day = subq_43.metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ WITH sma_28019_cte AS (
FROM ***************************.fct_visits visits_source_src_28000
)

, rss_28018_cte AS (
-- Read From Time Spine 'mf_time_spine'
SELECT
ds AS ds__day
FROM ***************************.mf_time_spine time_spine_src_28006
)

SELECT
metric_time__day AS metric_time__day
, CAST(buys AS DOUBLE PRECISION) / CAST(NULLIF(visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days_fill_nulls_with_0
Expand All @@ -27,9 +34,9 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_26.visits AS visits
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Read From CTE For node_id=sma_28019
-- Pass Only Elements: ['visits', 'metric_time__day']
Expand All @@ -42,14 +49,14 @@ FROM (
metric_time__day
) subq_26
ON
time_spine_src_28006.ds = subq_26.metric_time__day
rss_28018_cte.ds__day = subq_26.metric_time__day
) subq_30
FULL OUTER JOIN (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_39.buys AS buys
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'metric_time__day']
Expand Down Expand Up @@ -113,7 +120,7 @@ FROM (
metric_time__day
) subq_39
ON
time_spine_src_28006.ds = subq_39.metric_time__day
rss_28018_cte.ds__day = subq_39.metric_time__day
) subq_43
ON
subq_30.metric_time__day = subq_43.metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ WITH sma_28019_cte AS (
FROM ***************************.fct_visits visits_source_src_28000
)

, rss_28018_cte AS (
-- Read From Time Spine 'mf_time_spine'
SELECT
ds AS ds__day
FROM ***************************.mf_time_spine time_spine_src_28006
)

SELECT
metric_time__day AS metric_time__day
, CAST(buys AS DOUBLE PRECISION) / CAST(NULLIF(visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days_fill_nulls_with_0
Expand All @@ -27,9 +34,9 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_26.visits AS visits
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Read From CTE For node_id=sma_28019
-- Pass Only Elements: ['visits', 'metric_time__day']
Expand All @@ -42,14 +49,14 @@ FROM (
metric_time__day
) subq_26
ON
time_spine_src_28006.ds = subq_26.metric_time__day
rss_28018_cte.ds__day = subq_26.metric_time__day
) subq_30
FULL OUTER JOIN (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_39.buys AS buys
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'metric_time__day']
Expand Down Expand Up @@ -113,7 +120,7 @@ FROM (
metric_time__day
) subq_39
ON
time_spine_src_28006.ds = subq_39.metric_time__day
rss_28018_cte.ds__day = subq_39.metric_time__day
) subq_43
ON
subq_30.metric_time__day = subq_43.metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ WITH sma_28019_cte AS (
FROM ***************************.fct_visits visits_source_src_28000
)

, rss_28018_cte AS (
-- Read From Time Spine 'mf_time_spine'
SELECT
ds AS ds__day
FROM ***************************.mf_time_spine time_spine_src_28006
)

SELECT
metric_time__day AS metric_time__day
, CAST(buys AS DOUBLE) / CAST(NULLIF(visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days_fill_nulls_with_0
Expand All @@ -27,9 +34,9 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_26.visits AS visits
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Read From CTE For node_id=sma_28019
-- Pass Only Elements: ['visits', 'metric_time__day']
Expand All @@ -42,14 +49,14 @@ FROM (
metric_time__day
) subq_26
ON
time_spine_src_28006.ds = subq_26.metric_time__day
rss_28018_cte.ds__day = subq_26.metric_time__day
) subq_30
FULL OUTER JOIN (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_39.buys AS buys
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'metric_time__day']
Expand Down Expand Up @@ -113,7 +120,7 @@ FROM (
metric_time__day
) subq_39
ON
time_spine_src_28006.ds = subq_39.metric_time__day
rss_28018_cte.ds__day = subq_39.metric_time__day
) subq_43
ON
subq_30.metric_time__day = subq_43.metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ WITH sma_28019_cte AS (
FROM ***************************.fct_visits visits_source_src_28000
)

, rss_28018_cte AS (
-- Read From Time Spine 'mf_time_spine'
SELECT
ds AS ds__day
FROM ***************************.mf_time_spine time_spine_src_28006
)

SELECT
metric_time__day AS metric_time__day
, CAST(buys AS DOUBLE) / CAST(NULLIF(visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days_fill_nulls_with_0
Expand All @@ -27,9 +34,9 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_26.visits AS visits
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Read From CTE For node_id=sma_28019
-- Pass Only Elements: ['visits', 'metric_time__day']
Expand All @@ -42,14 +49,14 @@ FROM (
metric_time__day
) subq_26
ON
time_spine_src_28006.ds = subq_26.metric_time__day
rss_28018_cte.ds__day = subq_26.metric_time__day
) subq_30
FULL OUTER JOIN (
-- Join to Time Spine Dataset
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, subq_39.buys AS buys
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
LEFT OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'metric_time__day']
Expand Down Expand Up @@ -113,7 +120,7 @@ FROM (
metric_time__day
) subq_39
ON
time_spine_src_28006.ds = subq_39.metric_time__day
rss_28018_cte.ds__day = subq_39.metric_time__day
) subq_43
ON
subq_30.metric_time__day = subq_43.metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ WITH sma_28009_cte AS (
FROM ***************************.fct_bookings bookings_source_src_28000
)

, rss_28018_cte AS (
-- Read From Time Spine 'mf_time_spine'
SELECT
ds AS ds__day
FROM ***************************.mf_time_spine time_spine_src_28006
)

SELECT
metric_time__day AS metric_time__day
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
Expand All @@ -27,13 +34,13 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, SUM(sma_28009_cte.bookings) AS month_start_bookings
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
INNER JOIN
sma_28009_cte sma_28009_cte
ON
DATETIME_TRUNC(time_spine_src_28006.ds, month) = sma_28009_cte.metric_time__day
DATETIME_TRUNC(rss_28018_cte.ds__day, month) = sma_28009_cte.metric_time__day
GROUP BY
metric_time__day
) subq_27
Expand All @@ -43,13 +50,13 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
time_spine_src_28006.ds AS metric_time__day
rss_28018_cte.ds__day AS metric_time__day
, SUM(sma_28009_cte.bookings) AS bookings_1_month_ago
FROM ***************************.mf_time_spine time_spine_src_28006
FROM rss_28018_cte rss_28018_cte
INNER JOIN
sma_28009_cte sma_28009_cte
ON
DATE_SUB(CAST(time_spine_src_28006.ds AS DATETIME), INTERVAL 1 month) = sma_28009_cte.metric_time__day
DATE_SUB(CAST(rss_28018_cte.ds__day AS DATETIME), INTERVAL 1 month) = sma_28009_cte.metric_time__day
GROUP BY
metric_time__day
) subq_35
Expand Down
Loading

0 comments on commit eeb0105

Please sign in to comment.