Skip to content

Commit

Permalink
Update DuckDB snapshots for cleanup
Browse files Browse the repository at this point in the history
Should not result in any functional changes.
  • Loading branch information
courtneyholcomb committed Nov 21, 2024
1 parent 483a15f commit 73a8591
Show file tree
Hide file tree
Showing 41 changed files with 121 additions and 108 deletions.
14 changes: 7 additions & 7 deletions metricflow/plan_conversion/dataflow_to_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,16 @@ def _make_time_spine_data_set(
"""
time_spine_table_alias = self._next_unique_table_alias()

queried_specs = {instance.spec for instance in agg_time_dimension_instances}
specs_required_for_where_constraints = {
queried_specs = [instance.spec for instance in agg_time_dimension_instances]
queried_specs_set = set(queried_specs)
specs_required_for_where_constraints = [
spec
for constraint in time_spine_where_constraints
for spec in constraint.linkable_spec_set.time_dimension_specs
}
required_specs = sorted( # sorted for consistency in snapshots
queried_specs.union(specs_required_for_where_constraints),
key=lambda spec: (spec.element_name, spec.time_granularity.base_granularity.to_int()),
)
if spec not in queried_specs_set
]
required_specs = queried_specs + specs_required_for_where_constraints

time_spine_sources = TimeSpineSource.choose_time_spine_sources(
required_time_spine_specs=required_specs, time_spine_sources=self._time_spine_sources
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
DATE_TRUNC('month', subq_7.metric_time__day) AS booking__ds__month
subq_7.booking__ds__month AS booking__ds__month
, subq_7.metric_time__day AS metric_time__day
, DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week
, subq_7.metric_time__week AS metric_time__week
, subq_6.bookers AS bookers
FROM (
-- Time Spine
SELECT
subq_8.ds AS metric_time__day
DATE_TRUNC('month', subq_8.ds) AS booking__ds__month
, subq_8.ds AS metric_time__day
, DATE_TRUNC('week', subq_8.ds) AS metric_time__week
FROM ***************************.mf_time_spine subq_8
) subq_7
LEFT OUTER JOIN (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ FROM (
-- Join to Time Spine Dataset
-- Join to Custom Granularity Dataset
SELECT
subq_2.booking__ds__day AS booking__ds__day
, subq_1.ds__day AS ds__day
subq_1.ds__day AS ds__day
, subq_1.ds__week AS ds__week
, subq_1.ds__month AS ds__month
, subq_1.ds__quarter AS ds__quarter
Expand Down Expand Up @@ -102,6 +101,7 @@ FROM (
, subq_1.metric_time__extract_day AS metric_time__extract_day
, subq_1.metric_time__extract_dow AS metric_time__extract_dow
, subq_1.metric_time__extract_doy AS metric_time__extract_doy
, subq_2.booking__ds__day AS booking__ds__day
, subq_1.listing AS listing
, subq_1.guest AS guest
, subq_1.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ FROM (
-- Join to Time Spine Dataset
-- Join to Custom Granularity Dataset
SELECT
subq_2.metric_time__day AS metric_time__day
, subq_1.ds__day AS ds__day
subq_1.ds__day AS ds__day
, subq_1.ds__week AS ds__week
, subq_1.ds__month AS ds__month
, subq_1.ds__quarter AS ds__quarter
Expand Down Expand Up @@ -204,6 +203,7 @@ FROM (
, subq_1.metric_time__extract_day AS metric_time__extract_day
, subq_1.metric_time__extract_dow AS metric_time__extract_dow
, subq_1.metric_time__extract_doy AS metric_time__extract_doy
, subq_2.metric_time__day AS metric_time__day
, subq_1.listing AS listing
, subq_1.guest AS guest
, subq_1.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
subq_5.metric_time__day AS metric_time__day
, subq_4.ds__day AS ds__day
subq_4.ds__day AS ds__day
, subq_4.ds__week AS ds__week
, subq_4.ds__month AS ds__month
, subq_4.ds__quarter AS ds__quarter
Expand Down Expand Up @@ -202,6 +201,7 @@ FROM (
, subq_4.metric_time__extract_day AS metric_time__extract_day
, subq_4.metric_time__extract_dow AS metric_time__extract_dow
, subq_4.metric_time__extract_doy AS metric_time__extract_doy
, subq_5.metric_time__day AS metric_time__day
, subq_4.listing AS listing
, subq_4.guest AS guest
, subq_4.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
subq_2.metric_time__month AS metric_time__month
, subq_1.ds__month AS ds__month
subq_1.ds__month AS ds__month
, subq_1.ds__quarter AS ds__quarter
, subq_1.ds__year AS ds__year
, subq_1.ds__extract_year AS ds__extract_year
Expand All @@ -42,6 +41,7 @@ FROM (
, subq_1.metric_time__extract_year AS metric_time__extract_year
, subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
, subq_1.metric_time__extract_month AS metric_time__extract_month
, subq_2.metric_time__month AS metric_time__month
, subq_1.listing AS listing
, subq_1.booking_monthly__listing AS booking_monthly__listing
, subq_1.bookings_monthly AS bookings_monthly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
subq_7.metric_time__day AS metric_time__day
, subq_6.ds__day AS ds__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
Expand Down Expand Up @@ -322,6 +321,7 @@ FROM (
, subq_6.metric_time__extract_day AS metric_time__extract_day
, subq_6.metric_time__extract_dow AS metric_time__extract_dow
, subq_6.metric_time__extract_doy AS metric_time__extract_doy
, subq_7.metric_time__day AS metric_time__day
, subq_6.listing AS listing
, subq_6.guest AS guest
, subq_6.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week
, subq_6.ds__day AS ds__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
Expand Down Expand Up @@ -312,7 +311,6 @@ FROM (
, subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
, subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
, subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
, subq_6.metric_time__day AS metric_time__day
, subq_6.metric_time__month AS metric_time__month
, subq_6.metric_time__quarter AS metric_time__quarter
, subq_6.metric_time__year AS metric_time__year
Expand All @@ -322,6 +320,8 @@ FROM (
, subq_6.metric_time__extract_day AS metric_time__extract_day
, subq_6.metric_time__extract_dow AS metric_time__extract_dow
, subq_6.metric_time__extract_doy AS metric_time__extract_doy
, subq_7.metric_time__day AS metric_time__day
, subq_7.metric_time__week AS metric_time__week
, subq_6.listing AS listing
, subq_6.guest AS guest
, subq_6.host AS host
Expand All @@ -347,6 +347,7 @@ FROM (
-- Time Spine
SELECT
subq_8.ds AS metric_time__day
, DATE_TRUNC('week', subq_8.ds) AS metric_time__week
FROM ***************************.mf_time_spine subq_8
) subq_7
INNER JOIN (
Expand Down Expand Up @@ -546,7 +547,7 @@ FROM (
) subq_6
ON
DATE_TRUNC('month', subq_7.metric_time__day) = subq_6.metric_time__day
WHERE DATE_TRUNC('week', subq_7.metric_time__day) = subq_7.metric_time__day
WHERE subq_7.metric_time__week = subq_7.metric_time__day
) subq_9
) subq_10
GROUP BY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
subq_7.metric_time__day AS metric_time__day
, subq_6.ds__day AS ds__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
Expand Down Expand Up @@ -322,6 +321,7 @@ FROM (
, subq_6.metric_time__extract_day AS metric_time__extract_day
, subq_6.metric_time__extract_dow AS metric_time__extract_dow
, subq_6.metric_time__extract_doy AS metric_time__extract_doy
, subq_7.metric_time__day AS metric_time__day
, subq_6.listing AS listing
, subq_6.guest AS guest
, subq_6.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter
, subq_6.ds__day AS ds__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
Expand Down Expand Up @@ -312,7 +311,6 @@ FROM (
, subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
, subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
, subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
, subq_6.metric_time__day AS metric_time__day
, subq_6.metric_time__week AS metric_time__week
, subq_6.metric_time__month AS metric_time__month
, subq_6.metric_time__year AS metric_time__year
Expand All @@ -322,6 +320,8 @@ FROM (
, subq_6.metric_time__extract_day AS metric_time__extract_day
, subq_6.metric_time__extract_dow AS metric_time__extract_dow
, subq_6.metric_time__extract_doy AS metric_time__extract_doy
, subq_7.metric_time__day AS metric_time__day
, subq_7.metric_time__quarter AS metric_time__quarter
, subq_6.listing AS listing
, subq_6.guest AS guest
, subq_6.host AS host
Expand All @@ -347,6 +347,7 @@ FROM (
-- Time Spine
SELECT
subq_8.ds AS metric_time__day
, DATE_TRUNC('quarter', subq_8.ds) AS metric_time__quarter
FROM ***************************.mf_time_spine subq_8
) subq_7
INNER JOIN (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
subq_2.metric_time__day AS metric_time__day
, subq_1.ds__day AS ds__day
subq_1.ds__day AS ds__day
, subq_1.ds__week AS ds__week
, subq_1.ds__month AS ds__month
, subq_1.ds__quarter AS ds__quarter
Expand Down Expand Up @@ -107,6 +106,7 @@ FROM (
, subq_1.metric_time__extract_day AS metric_time__extract_day
, subq_1.metric_time__extract_dow AS metric_time__extract_dow
, subq_1.metric_time__extract_doy AS metric_time__extract_doy
, subq_2.metric_time__day AS metric_time__day
, subq_1.listing AS listing
, subq_1.guest AS guest
, subq_1.host AS host
Expand Down Expand Up @@ -355,8 +355,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
subq_10.metric_time__day AS metric_time__day
, subq_9.ds__day AS ds__day
subq_9.ds__day AS ds__day
, subq_9.ds__week AS ds__week
, subq_9.ds__month AS ds__month
, subq_9.ds__quarter AS ds__quarter
Expand Down Expand Up @@ -432,6 +431,7 @@ FROM (
, subq_9.metric_time__extract_day AS metric_time__extract_day
, subq_9.metric_time__extract_dow AS metric_time__extract_dow
, subq_9.metric_time__extract_doy AS metric_time__extract_doy
, subq_10.metric_time__day AS metric_time__day
, subq_9.listing AS listing
, subq_9.guest AS guest
, subq_9.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year
, subq_1.ds__day AS ds__day
subq_1.ds__day AS ds__day
, subq_1.ds__week AS ds__week
, subq_1.ds__month AS ds__month
, subq_1.ds__quarter AS ds__quarter
Expand Down Expand Up @@ -97,7 +96,6 @@ FROM (
, subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
, subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
, subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
, subq_1.metric_time__day AS metric_time__day
, subq_1.metric_time__week AS metric_time__week
, subq_1.metric_time__month AS metric_time__month
, subq_1.metric_time__quarter AS metric_time__quarter
Expand All @@ -107,6 +105,8 @@ FROM (
, subq_1.metric_time__extract_day AS metric_time__extract_day
, subq_1.metric_time__extract_dow AS metric_time__extract_dow
, subq_1.metric_time__extract_doy AS metric_time__extract_doy
, subq_2.metric_time__day AS metric_time__day
, subq_2.metric_time__year AS metric_time__year
, subq_1.listing AS listing
, subq_1.guest AS guest
, subq_1.host AS host
Expand All @@ -132,6 +132,7 @@ FROM (
-- Time Spine
SELECT
subq_3.ds AS metric_time__day
, DATE_TRUNC('year', subq_3.ds) AS metric_time__year
FROM ***************************.mf_time_spine subq_3
) subq_2
INNER JOIN (
Expand Down Expand Up @@ -331,7 +332,7 @@ FROM (
) subq_1
ON
DATE_TRUNC('month', subq_2.metric_time__day) = subq_1.metric_time__day
WHERE DATE_TRUNC('year', subq_2.metric_time__day) = subq_2.metric_time__day
WHERE subq_2.metric_time__year = subq_2.metric_time__day
) subq_4
) subq_5
GROUP BY
Expand All @@ -356,8 +357,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year
, subq_9.ds__day AS ds__day
subq_9.ds__day AS ds__day
, subq_9.ds__week AS ds__week
, subq_9.ds__month AS ds__month
, subq_9.ds__quarter AS ds__quarter
Expand Down Expand Up @@ -423,7 +423,6 @@ FROM (
, subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
, subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
, subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
, subq_9.metric_time__day AS metric_time__day
, subq_9.metric_time__week AS metric_time__week
, subq_9.metric_time__month AS metric_time__month
, subq_9.metric_time__quarter AS metric_time__quarter
Expand All @@ -433,6 +432,8 @@ FROM (
, subq_9.metric_time__extract_day AS metric_time__extract_day
, subq_9.metric_time__extract_dow AS metric_time__extract_dow
, subq_9.metric_time__extract_doy AS metric_time__extract_doy
, subq_10.metric_time__day AS metric_time__day
, subq_10.metric_time__year AS metric_time__year
, subq_9.listing AS listing
, subq_9.guest AS guest
, subq_9.host AS host
Expand All @@ -458,6 +459,7 @@ FROM (
-- Time Spine
SELECT
subq_11.ds AS metric_time__day
, DATE_TRUNC('year', subq_11.ds) AS metric_time__year
FROM ***************************.mf_time_spine subq_11
) subq_10
INNER JOIN (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
subq_8.metric_time__day AS metric_time__day
, subq_7.ds__day AS ds__day
subq_7.ds__day AS ds__day
, subq_7.ds__week AS ds__week
, subq_7.ds__month AS ds__month
, subq_7.ds__quarter AS ds__quarter
Expand Down Expand Up @@ -526,6 +525,7 @@ FROM (
, subq_7.metric_time__extract_day AS metric_time__extract_day
, subq_7.metric_time__extract_dow AS metric_time__extract_dow
, subq_7.metric_time__extract_doy AS metric_time__extract_doy
, subq_8.metric_time__day AS metric_time__day
, subq_7.listing AS listing
, subq_7.guest AS guest
, subq_7.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
subq_5.metric_time__day AS metric_time__day
, subq_4.ds__day AS ds__day
subq_4.ds__day AS ds__day
, subq_4.ds__week AS ds__week
, subq_4.ds__month AS ds__month
, subq_4.ds__quarter AS ds__quarter
Expand Down Expand Up @@ -101,6 +100,7 @@ FROM (
, subq_4.metric_time__extract_day AS metric_time__extract_day
, subq_4.metric_time__extract_dow AS metric_time__extract_dow
, subq_4.metric_time__extract_doy AS metric_time__extract_doy
, subq_5.metric_time__day AS metric_time__day
, subq_4.listing AS listing
, subq_4.guest AS guest
, subq_4.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
subq_2.booking__ds__day AS booking__ds__day
, subq_1.ds__day AS ds__day
subq_1.ds__day AS ds__day
, subq_1.ds__week AS ds__week
, subq_1.ds__month AS ds__month
, subq_1.ds__quarter AS ds__quarter
Expand Down Expand Up @@ -107,6 +106,7 @@ FROM (
, subq_1.metric_time__extract_day AS metric_time__extract_day
, subq_1.metric_time__extract_dow AS metric_time__extract_dow
, subq_1.metric_time__extract_doy AS metric_time__extract_doy
, subq_2.booking__ds__day AS booking__ds__day
, subq_1.listing AS listing
, subq_1.guest AS guest
, subq_1.host AS host
Expand Down
Loading

0 comments on commit 73a8591

Please sign in to comment.