Skip to content

Commit

Permalink
Update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Aug 16, 2023
1 parent d87b1e2 commit 8d57703
Show file tree
Hide file tree
Showing 84 changed files with 7,227 additions and 699 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
-- Compute Metrics via Expressions
SELECT
subq_4.ds__month
, subq_4.txn_revenue AS trailing_2_months_revenue
subq_3.ds__month
, subq_3.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
subq_3.ds__month
, SUM(subq_3.txn_revenue) AS txn_revenue
subq_2.ds__month
, SUM(subq_2.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements:
-- ['txn_revenue', 'ds__month']
Expand Down Expand Up @@ -53,7 +53,7 @@ FROM (
FROM ***************************.fct_revenue revenue_src_10006
) subq_0
) subq_1
) subq_3
) subq_2
GROUP BY
subq_3.ds__month
) subq_4
subq_2.ds__month
) subq_3
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
-- Compute Metrics via Expressions
SELECT
subq_4.ds__month
, subq_4.txn_revenue AS revenue_mtd
subq_3.ds__month
, subq_3.txn_revenue AS revenue_mtd
FROM (
-- Aggregate Measures
SELECT
subq_3.ds__month
, SUM(subq_3.txn_revenue) AS txn_revenue
subq_2.ds__month
, SUM(subq_2.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements:
-- ['txn_revenue', 'ds__month']
Expand Down Expand Up @@ -53,7 +53,7 @@ FROM (
FROM ***************************.fct_revenue revenue_src_10006
) subq_0
) subq_1
) subq_3
) subq_2
GROUP BY
subq_3.ds__month
) subq_4
subq_2.ds__month
) subq_3
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
-- Compute Metrics via Expressions
SELECT
subq_4.txn_revenue AS trailing_2_months_revenue
subq_3.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
SUM(subq_3.txn_revenue) AS txn_revenue
SUM(subq_2.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements:
-- ['txn_revenue']
Expand Down Expand Up @@ -50,5 +50,5 @@ FROM (
FROM ***************************.fct_revenue revenue_src_10006
) subq_0
) subq_1
) subq_3
) subq_4
) subq_2
) subq_3
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
-- Compute Metrics via Expressions
SELECT
subq_4.ds__month
, subq_4.txn_revenue AS revenue_all_time
subq_3.ds__month
, subq_3.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
subq_3.ds__month
, SUM(subq_3.txn_revenue) AS txn_revenue
subq_2.ds__month
, SUM(subq_2.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements:
-- ['txn_revenue', 'ds__month']
Expand Down Expand Up @@ -53,7 +53,7 @@ FROM (
FROM ***************************.fct_revenue revenue_src_10006
) subq_0
) subq_1
) subq_3
) subq_2
GROUP BY
subq_3.ds__month
) subq_4
subq_2.ds__month
) subq_3
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
-- Compute Metrics via Expressions
SELECT
subq_5.ds__month
, subq_5.txn_revenue AS revenue_all_time
subq_4.ds__month
, subq_4.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
subq_4.ds__month
, SUM(subq_4.txn_revenue) AS txn_revenue
subq_3.ds__month
, SUM(subq_3.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements:
-- ['txn_revenue', 'ds__month']
Expand Down Expand Up @@ -76,7 +76,7 @@ FROM (
) subq_1
WHERE subq_1.metric_time__day BETWEEN CAST('2000-01-01' AS TIMESTAMP) AND CAST('2020-01-01' AS TIMESTAMP)
) subq_2
) subq_4
) subq_3
GROUP BY
subq_4.ds__month
) subq_5
subq_3.ds__month
) subq_4
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
-- Compute Metrics via Expressions
SELECT
subq_5.ds__month
, subq_5.txn_revenue AS trailing_2_months_revenue
subq_4.ds__month
, subq_4.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
subq_4.ds__month
, SUM(subq_4.txn_revenue) AS txn_revenue
subq_3.ds__month
, SUM(subq_3.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements:
-- ['txn_revenue', 'ds__month']
Expand Down Expand Up @@ -76,7 +76,7 @@ FROM (
) subq_1
WHERE subq_1.metric_time__day BETWEEN CAST('2019-12-01' AS TIMESTAMP) AND CAST('2020-01-01' AS TIMESTAMP)
) subq_2
) subq_4
) subq_3
GROUP BY
subq_4.ds__month
) subq_5
subq_3.ds__month
) subq_4
Original file line number Diff line number Diff line change
Expand Up @@ -147,33 +147,85 @@ FROM (
) subq_3
) subq_4
INNER JOIN (
-- Join to Time Spine Dataset
-- Compute Metrics via Expressions
SELECT
subq_10.metric_time__day AS metric_time__day
, subq_9.bookings_at_start_of_month AS bookings_at_start_of_month
subq_11.metric_time__day
, subq_11.bookings AS bookings_at_start_of_month
FROM (
-- Date Spine
SELECT
subq_11.ds AS metric_time__day
FROM ***************************.mf_time_spine subq_11
) subq_10
INNER JOIN (
-- Compute Metrics via Expressions
-- Aggregate Measures
SELECT
subq_8.metric_time__day
, subq_8.bookings AS bookings_at_start_of_month
subq_10.metric_time__day
, SUM(subq_10.bookings) AS bookings
FROM (
-- Aggregate Measures
-- Pass Only Elements:
-- ['bookings', 'metric_time__day']
SELECT
subq_7.metric_time__day
, SUM(subq_7.bookings) AS bookings
subq_9.metric_time__day
, subq_9.bookings
FROM (
-- Pass Only Elements:
-- ['bookings', 'metric_time__day']
-- Join to Time Spine Dataset
SELECT
subq_6.metric_time__day
, subq_6.bookings
DATE_TRUNC('day', subq_7.metric_time__day) AS metric_time__day
, subq_6.ds__day AS ds__day
, subq_6.ds__week AS ds__week
, subq_6.ds__month AS ds__month
, subq_6.ds__quarter AS ds__quarter
, subq_6.ds__year AS ds__year
, subq_6.ds_partitioned__day AS ds_partitioned__day
, subq_6.ds_partitioned__week AS ds_partitioned__week
, subq_6.ds_partitioned__month AS ds_partitioned__month
, subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
, subq_6.ds_partitioned__year AS ds_partitioned__year
, subq_6.paid_at__day AS paid_at__day
, subq_6.paid_at__week AS paid_at__week
, subq_6.paid_at__month AS paid_at__month
, subq_6.paid_at__quarter AS paid_at__quarter
, subq_6.paid_at__year AS paid_at__year
, subq_6.booking__ds__day AS booking__ds__day
, subq_6.booking__ds__week AS booking__ds__week
, subq_6.booking__ds__month AS booking__ds__month
, subq_6.booking__ds__quarter AS booking__ds__quarter
, subq_6.booking__ds__year AS booking__ds__year
, subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
, subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
, subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
, subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
, subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
, subq_6.booking__paid_at__day AS booking__paid_at__day
, subq_6.booking__paid_at__week AS booking__paid_at__week
, subq_6.booking__paid_at__month AS booking__paid_at__month
, subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
, subq_6.booking__paid_at__year AS booking__paid_at__year
, subq_6.listing AS listing
, subq_6.guest AS guest
, subq_6.host AS host
, subq_6.booking__listing AS booking__listing
, subq_6.booking__guest AS booking__guest
, subq_6.booking__host AS booking__host
, subq_6.is_instant AS is_instant
, subq_6.booking__is_instant AS booking__is_instant
, subq_6.bookings AS bookings
, subq_6.instant_bookings AS instant_bookings
, subq_6.booking_value AS booking_value
, subq_6.max_booking_value AS max_booking_value
, subq_6.min_booking_value AS min_booking_value
, subq_6.bookers AS bookers
, subq_6.average_booking_value AS average_booking_value
, subq_6.referred_bookings AS referred_bookings
, subq_6.median_booking_value AS median_booking_value
, subq_6.booking_value_p99 AS booking_value_p99
, subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
, subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
, subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Date Spine
SELECT
subq_8.ds AS metric_time__day
FROM ***************************.mf_time_spine subq_8
GROUP BY
subq_8.ds
) subq_7
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
subq_5.ds__day
Expand Down Expand Up @@ -290,13 +342,13 @@ FROM (
FROM ***************************.fct_bookings bookings_source_src_10001
) subq_5
) subq_6
) subq_7
GROUP BY
subq_7.metric_time__day
) subq_8
) subq_9
ON
DATE_TRUNC('month', subq_10.metric_time__day) = subq_9.metric_time__day
ON
DATE_TRUNC('month', subq_7.metric_time__day) = subq_6.metric_time__day
) subq_9
) subq_10
GROUP BY
subq_10.metric_time__day
) subq_11
) subq_12
ON
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,33 @@ FROM (
) subq_18
INNER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements:
-- ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
subq_25.ds AS metric_time__day
, subq_23.bookings_at_start_of_month AS bookings_at_start_of_month
FROM ***************************.mf_time_spine subq_25
INNER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
DATE_TRUNC('day', subq_21.metric_time__day) AS metric_time__day
, SUM(subq_20.bookings) AS bookings_at_start_of_month
FROM (
-- Date Spine
SELECT
metric_time__day
, SUM(bookings) AS bookings_at_start_of_month
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
-- Pass Only Elements:
-- ['bookings', 'metric_time__day']
SELECT
ds AS metric_time__day
, 1 AS bookings
FROM ***************************.fct_bookings bookings_source_src_10001
) subq_21
ds AS metric_time__day
FROM ***************************.mf_time_spine subq_22
GROUP BY
metric_time__day
) subq_23
ds
) subq_21
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
ds AS metric_time__day
, 1 AS bookings
FROM ***************************.fct_bookings bookings_source_src_10001
) subq_20
ON
DATE_TRUNC('month', subq_25.ds) = subq_23.metric_time__day
DATE_TRUNC('month', subq_21.metric_time__day) = subq_20.metric_time__day
GROUP BY
DATE_TRUNC('day', subq_21.metric_time__day)
) subq_26
ON
(
Expand Down
Loading

0 comments on commit 8d57703

Please sign in to comment.