Skip to content

Commit

Permalink
Update SQL engine snapshots with ordering for FilterElements include …
Browse files Browse the repository at this point in the history
…specs
  • Loading branch information
courtneyholcomb committed Jul 27, 2024
1 parent e213ded commit 88dbe8b
Show file tree
Hide file tree
Showing 1,036 changed files with 3,053 additions and 2,902 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
sql?? -- Constrain Output with WHERE
-- Aggregate Measures
-- Compute Metrics via Expressions
-- Order By ['metric_time__day', 'listing__capacity_latest']
SELECT
metric_time__day
, listing__capacity_latest
, SUM(bookings) AS bookings
, SUM(instant_bookings) AS instant_bookings
FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'instant_bookings', 'listing__capacity_latest', 'metric_time__day']
SELECT
subq_2.metric_time__day AS metric_time__day
, listings_latest_src_10000.capacity AS listing__capacity_latest
, subq_2.bookings AS bookings
, subq_2.instant_bookings AS instant_bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
-- Pass Only Elements: ['bookings', 'instant_bookings', 'listing', 'metric_time__day']
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, 1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
FROM mf_test_src_7e6d94949943215.fct_bookings bookings_source_src_10000
) subq_2
LEFT OUTER JOIN
mf_test_src_7e6d94949943215.dim_listings_latest listings_latest_src_10000
ON
subq_2.listing = listings_latest_src_10000.listing_id
) subq_7
WHERE listing__capacity_latest > 3
GROUP BY
metric_time__day
, listing__capacity_latest
ORDER BY metric_time__day, listing__capacity_latest
metric_time__day listing__capacity_latest bookings instant_bookings
------------------- -------------------------- ---------- ------------------
2019-12-01T00:00:00 5 1 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
sql?? -- Join Self Over Time Range
-- Pass Only Elements: ['metric_time__day', 'txn_revenue']
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
-- Aggregate Measures
-- Compute Metrics via Expressions
-- Order By ['metric_time__day']
SELECT
subq_3.metric_time__day AS metric_time__day
, SUM(subq_2.txn_revenue) AS trailing_2_months_revenue
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
FROM mf_test_src_7e6d94949943215.mf_time_spine subq_4
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
) subq_3
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
-- Constrain Time Range to [2019-11-01T00:00:00, 2020-01-01T00:00:00]
SELECT
DATE_TRUNC('day', created_at) AS metric_time__day
, revenue AS txn_revenue
FROM mf_test_src_7e6d94949943215.fct_revenue revenue_src_10000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01'
) subq_2
ON
(
subq_2.metric_time__day <= subq_3.metric_time__day
) AND (
subq_2.metric_time__day > DATEADD(month, -2, subq_3.metric_time__day)
)
WHERE subq_3.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
subq_3.metric_time__day
ORDER BY metric_time__day
metric_time__day trailing_2_months_revenue
------------------- ---------------------------
2020-01-01T00:00:00 1000
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
sql?? -- Constrain Output with WHERE
-- Aggregate Measures
-- Compute Metrics via Expressions
-- Order By ['metric_time__day', 'listing__capacity_latest'] Limit 3
SELECT
metric_time__day
, listing__capacity_latest
, SUM(bookings) AS bookings
, SUM(instant_bookings) AS instant_bookings
FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'instant_bookings', 'listing__capacity_latest', 'metric_time__day']
SELECT
subq_2.metric_time__day AS metric_time__day
, listings_latest_src_10000.capacity AS listing__capacity_latest
, subq_2.bookings AS bookings
, subq_2.instant_bookings AS instant_bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
-- Pass Only Elements: ['bookings', 'instant_bookings', 'listing', 'metric_time__day']
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, 1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
FROM mf_test_src_7e6d94949943215.fct_bookings bookings_source_src_10000
) subq_2
LEFT OUTER JOIN
mf_test_src_7e6d94949943215.dim_listings_latest listings_latest_src_10000
ON
subq_2.listing = listings_latest_src_10000.listing_id
) subq_7
WHERE listing__capacity_latest > 3
GROUP BY
metric_time__day
, listing__capacity_latest
ORDER BY metric_time__day, listing__capacity_latest
LIMIT 3
metric_time__day listing__capacity_latest bookings instant_bookings
------------------- -------------------------- ---------- ------------------
2019-12-01T00:00:00 5 1 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
sql?? -- Constrain Output with WHERE
-- Aggregate Measures
-- Compute Metrics via Expressions
-- Order By ['metric_time__day', 'listing__capacity_latest']
SELECT
metric_time__day
, listing__capacity_latest
, SUM(bookings) AS bookings
, SUM(instant_bookings) AS instant_bookings
FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'instant_bookings', 'listing__capacity_latest', 'metric_time__day']
SELECT
subq_2.metric_time__day AS metric_time__day
, listings_latest_src_10000.capacity AS listing__capacity_latest
, subq_2.bookings AS bookings
, subq_2.instant_bookings AS instant_bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
-- Pass Only Elements: ['bookings', 'instant_bookings', 'listing', 'metric_time__day']
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, 1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
FROM mf_test_src_7e6d94949943215.fct_bookings bookings_source_src_10000
) subq_2
LEFT OUTER JOIN
mf_test_src_7e6d94949943215.dim_listings_latest listings_latest_src_10000
ON
subq_2.listing = listings_latest_src_10000.listing_id
) subq_7
WHERE ( listing__capacity_latest > 3 ) AND ( listing__capacity_latest > 4 )
GROUP BY
metric_time__day
, listing__capacity_latest
ORDER BY metric_time__day, listing__capacity_latest
metric_time__day listing__capacity_latest bookings instant_bookings
------------------- -------------------------- ---------- ------------------
2019-12-01T00:00:00 5 1 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FROM (
subq_2.metric_time__day
, subq_2.visits
FROM (
-- Pass Only Elements: ['visits', 'metric_time__day']
-- Pass Only Elements: ['metric_time__day', 'visits']
SELECT
subq_1.metric_time__day
, subq_1.visits
Expand Down Expand Up @@ -165,7 +165,7 @@ FROM (
, subq_10.mf_internal_uuid AS mf_internal_uuid
, subq_10.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'metric_time__day', 'user']
-- Pass Only Elements: ['ds__day', 'metric_time__day', 'user', 'visits']
SELECT
subq_6.ds__day
, subq_6.metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
-- Pass Only Elements: ['visits', 'metric_time__day']
-- Pass Only Elements: ['metric_time__day', 'visits']
SELECT
DATETIME_TRUNC(ds, day) AS metric_time__day
, 1 AS visits
Expand Down Expand Up @@ -74,7 +74,7 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
-- Pass Only Elements: ['visits', 'ds__day', 'metric_time__day', 'user']
-- Pass Only Elements: ['ds__day', 'metric_time__day', 'user', 'visits']
SELECT
DATETIME_TRUNC(ds, day) AS ds__day
, DATETIME_TRUNC(ds, day) AS metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FROM (
, subq_2.visit__referrer_id
, subq_2.visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
-- Pass Only Elements: ['metric_time__day', 'visit__referrer_id', 'visits']
SELECT
subq_1.metric_time__day
, subq_1.visit__referrer_id
Expand Down Expand Up @@ -122,7 +122,7 @@ FROM (
, subq_13.visit__referrer_id
, SUM(subq_13.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
-- Pass Only Elements: ['buys', 'metric_time__day', 'visit__referrer_id']
SELECT
subq_12.metric_time__day
, subq_12.visit__referrer_id
Expand Down Expand Up @@ -182,7 +182,7 @@ FROM (
, subq_10.mf_internal_uuid AS mf_internal_uuid
, subq_10.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
-- Pass Only Elements: ['ds__day', 'metric_time__day', 'user', 'visit__referrer_id', 'visits']
SELECT
subq_6.ds__day
, subq_6.metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FROM (
, MAX(subq_30.buys) AS buys
FROM (
-- Constrain Output with WHERE
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
-- Pass Only Elements: ['metric_time__day', 'visit__referrer_id', 'visits']
-- Aggregate Measures
SELECT
metric_time__day
Expand All @@ -34,7 +34,7 @@ FROM (
) subq_20
FULL OUTER JOIN (
-- Find conversions for user within the range of INF
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
-- Pass Only Elements: ['buys', 'metric_time__day', 'visit__referrer_id']
-- Aggregate Measures
SELECT
metric_time__day
Expand Down Expand Up @@ -88,7 +88,7 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
-- Pass Only Elements: ['ds__day', 'metric_time__day', 'user', 'visit__referrer_id', 'visits']
SELECT
DATETIME_TRUNC(ds, day) AS ds__day
, DATETIME_TRUNC(ds, day) AS metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FROM (
subq_3.visit__referrer_id
, subq_3.visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id']
-- Pass Only Elements: ['visit__referrer_id', 'visits']
SELECT
subq_2.visit__referrer_id
, subq_2.visits
Expand Down Expand Up @@ -211,7 +211,7 @@ FROM (
, subq_12.mf_internal_uuid AS mf_internal_uuid
, subq_12.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user']
-- Pass Only Elements: ['ds__day', 'user', 'visit__referrer_id', 'visits']
SELECT
subq_8.ds__day
, subq_8.user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ FROM (
FROM (
-- Constrain Output with WHERE
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00]
-- Pass Only Elements: ['visits', 'visit__referrer_id']
-- Pass Only Elements: ['visit__referrer_id', 'visits']
-- Aggregate Measures
SELECT
visit__referrer_id
Expand Down Expand Up @@ -81,7 +81,7 @@ FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00]
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user']
-- Pass Only Elements: ['ds__day', 'user', 'visit__referrer_id', 'visits']
SELECT
DATETIME_TRUNC(ds, day) AS ds__day
, user_id AS user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FROM (
subq_2.metric_time__day
, subq_2.visits
FROM (
-- Pass Only Elements: ['visits', 'metric_time__day']
-- Pass Only Elements: ['metric_time__day', 'visits']
SELECT
subq_1.metric_time__day
, subq_1.visits
Expand Down Expand Up @@ -165,7 +165,7 @@ FROM (
, subq_10.mf_internal_uuid AS mf_internal_uuid
, subq_10.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'metric_time__day', 'user']
-- Pass Only Elements: ['ds__day', 'metric_time__day', 'user', 'visits']
SELECT
subq_6.ds__day
, subq_6.metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
-- Pass Only Elements: ['visits', 'metric_time__day']
-- Pass Only Elements: ['metric_time__day', 'visits']
SELECT
DATETIME_TRUNC(ds, day) AS metric_time__day
, 1 AS visits
Expand Down Expand Up @@ -74,7 +74,7 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
-- Pass Only Elements: ['visits', 'ds__day', 'metric_time__day', 'user']
-- Pass Only Elements: ['ds__day', 'metric_time__day', 'user', 'visits']
SELECT
DATETIME_TRUNC(ds, day) AS ds__day
, DATETIME_TRUNC(ds, day) AS metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FROM (
, subq_3.visit__referrer_id
, subq_3.visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
-- Pass Only Elements: ['metric_time__day', 'visit__referrer_id', 'visits']
SELECT
subq_2.metric_time__day
, subq_2.visit__referrer_id
Expand Down Expand Up @@ -168,7 +168,7 @@ FROM (
, subq_15.visit__referrer_id
, SUM(subq_15.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
-- Pass Only Elements: ['buys', 'metric_time__day', 'visit__referrer_id']
SELECT
subq_14.metric_time__day
, subq_14.visit__referrer_id
Expand Down Expand Up @@ -228,7 +228,7 @@ FROM (
, subq_12.mf_internal_uuid AS mf_internal_uuid
, subq_12.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
-- Pass Only Elements: ['ds__day', 'metric_time__day', 'user', 'visit__referrer_id', 'visits']
SELECT
subq_8.ds__day
, subq_8.metric_time__day
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FROM (
FROM (
-- Constrain Output with WHERE
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00]
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
-- Pass Only Elements: ['metric_time__day', 'visit__referrer_id', 'visits']
-- Aggregate Measures
SELECT
metric_time__day
Expand All @@ -39,7 +39,7 @@ FROM (
) subq_23
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
-- Pass Only Elements: ['buys', 'metric_time__day', 'visit__referrer_id']
-- Aggregate Measures
SELECT
metric_time__day
Expand Down Expand Up @@ -94,7 +94,7 @@ FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00]
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
-- Pass Only Elements: ['ds__day', 'metric_time__day', 'user', 'visit__referrer_id', 'visits']
SELECT
DATETIME_TRUNC(ds, day) AS ds__day
, DATETIME_TRUNC(ds, day) AS metric_time__day
Expand Down
Loading

0 comments on commit 88dbe8b

Please sign in to comment.