Skip to content

Commit

Permalink
Update SQL engine snapshots
Browse files Browse the repository at this point in the history
Also removes some CLI snapshot output that was accidentally added due to a print statemen
  • Loading branch information
courtneyholcomb committed Jul 29, 2024
1 parent 11058a5 commit b9a0720
Show file tree
Hide file tree
Showing 35 changed files with 2,215 additions and 152 deletions.
Original file line number Diff line number Diff line change
@@ -1,41 +1,3 @@
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,39 +1,3 @@
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,42 +1,3 @@
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,41 +1,3 @@
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 @@ -33,8 +33,8 @@
<FilterElementsNode>
<!-- description = "Pass Only Elements: ['metric_time__day', 'metric_time__month']" -->
<!-- node_id = NodeId(id_str='pfe_2') -->
<!-- include_spec = TimeDimensionSpec(element_name='metric_time', time_granularity=DAY) -->
<!-- include_spec = TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH) -->
<!-- include_spec = TimeDimensionSpec(element_name='metric_time', time_granularity=DAY) -->
<!-- distinct = False -->
<MetricTimeDimensionTransformNode>
<!-- description = "Metric Time Dimension 'ds'" -->
Expand Down
Loading

0 comments on commit b9a0720

Please sign in to comment.