Skip to content

Commit

Permalink
Use dundered column names for min/max cols
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Dec 7, 2023
1 parent 2d80dea commit 4cfbbcc
Show file tree
Hide file tree
Showing 38 changed files with 80 additions and 80 deletions.
4 changes: 2 additions & 2 deletions metricflow/specs/specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from dbt_semantic_interfaces.dataclass_serialization import SerializableDataclass
from dbt_semantic_interfaces.implementations.metric import PydanticMetricTimeWindow
from dbt_semantic_interfaces.naming.keywords import METRIC_TIME_ELEMENT_NAME
from dbt_semantic_interfaces.naming.keywords import DUNDER, METRIC_TIME_ELEMENT_NAME
from dbt_semantic_interfaces.protocols import MetricTimeWindow
from dbt_semantic_interfaces.references import (
DimensionReference,
Expand Down Expand Up @@ -130,7 +130,7 @@ class MetadataSpec(InstanceSpec):

@property
def qualified_name(self) -> str: # noqa: D
return f"{self.agg_type.value}_{self.element_name}" if self.agg_type else self.element_name
return f"{self.element_name}{DUNDER}{self.agg_type.value}" if self.agg_type else self.element_name

@staticmethod
def from_name(name: str, agg_type: Optional[AggregationType] = None) -> MetadataSpec: # noqa: D
Expand Down
12 changes: 6 additions & 6 deletions metricflow/test/integration/test_cases/itest_dimensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ integration_test:
min_max_only: true
check_query: |
SELECT
MIN(user__home_state) AS min_user__home_state
, MAX(user__home_state) AS max_user__home_state
MIN(user__home_state) AS user__home_state__min
, MAX(user__home_state) AS user__home_state__max
FROM (
SELECT
u.home_state AS user__home_state
Expand All @@ -228,8 +228,8 @@ integration_test:
min_max_only: true
check_query: |
SELECT
MIN(verification__ds__day) AS min_verification__ds__day
, MAX(verification__ds__day) AS max_verification__ds__day
MIN(verification__ds__day) AS verification__ds__day__min
, MAX(verification__ds__day) AS verification__ds__day__max
FROM (
SELECT
v.ds as verification__ds__day
Expand All @@ -246,8 +246,8 @@ integration_test:
min_max_only: true
check_query: |
SELECT
MIN(verification__ds__month) AS min_verification__ds__month
, MAX(verification__ds__month) AS max_verification__ds__month
MIN(verification__ds__month) AS verification__ds__month__min
, MAX(verification__ds__month) AS verification__ds__month__max
FROM (
SELECT
{{ render_date_trunc("v.ds", TimeGranularity.MONTH) }} as verification__ds__month
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.listing__country_latest) AS min_listing__country_latest
, MAX(subq_1.listing__country_latest) AS max_listing__country_latest
MIN(subq_1.listing__country_latest) AS listing__country_latest__min
, MAX(subq_1.listing__country_latest) AS listing__country_latest__max
FROM (
-- Pass Only Elements:
-- ['listing__country_latest']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(listing__country_latest) AS min_listing__country_latest
, MAX(listing__country_latest) AS max_listing__country_latest
MIN(listing__country_latest) AS listing__country_latest__min
, MAX(listing__country_latest) AS listing__country_latest__max
FROM (
-- Read Elements From Semantic Model 'listings_latest'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__day) AS min_booking__paid_at__day
, MAX(subq_1.booking__paid_at__day) AS max_booking__paid_at__day
MIN(subq_1.booking__paid_at__day) AS booking__paid_at__day__min
, MAX(subq_1.booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__day']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__day) AS min_booking__paid_at__day
, MAX(booking__paid_at__day) AS max_booking__paid_at__day
MIN(booking__paid_at__day) AS booking__paid_at__day__min
, MAX(booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__quarter) AS min_booking__paid_at__quarter
, MAX(subq_1.booking__paid_at__quarter) AS max_booking__paid_at__quarter
MIN(subq_1.booking__paid_at__quarter) AS booking__paid_at__quarter__min
, MAX(subq_1.booking__paid_at__quarter) AS booking__paid_at__quarter__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__quarter']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__quarter) AS min_booking__paid_at__quarter
, MAX(booking__paid_at__quarter) AS max_booking__paid_at__quarter
MIN(booking__paid_at__quarter) AS booking__paid_at__quarter__min
, MAX(booking__paid_at__quarter) AS booking__paid_at__quarter__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.listing__country_latest) AS min_listing__country_latest
, MAX(subq_1.listing__country_latest) AS max_listing__country_latest
MIN(subq_1.listing__country_latest) AS listing__country_latest__min
, MAX(subq_1.listing__country_latest) AS listing__country_latest__max
FROM (
-- Pass Only Elements:
-- ['listing__country_latest']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(listing__country_latest) AS min_listing__country_latest
, MAX(listing__country_latest) AS max_listing__country_latest
MIN(listing__country_latest) AS listing__country_latest__min
, MAX(listing__country_latest) AS listing__country_latest__max
FROM (
-- Read Elements From Semantic Model 'listings_latest'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__day) AS min_booking__paid_at__day
, MAX(subq_1.booking__paid_at__day) AS max_booking__paid_at__day
MIN(subq_1.booking__paid_at__day) AS booking__paid_at__day__min
, MAX(subq_1.booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__day']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__day) AS min_booking__paid_at__day
, MAX(booking__paid_at__day) AS max_booking__paid_at__day
MIN(booking__paid_at__day) AS booking__paid_at__day__min
, MAX(booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__quarter) AS min_booking__paid_at__quarter
, MAX(subq_1.booking__paid_at__quarter) AS max_booking__paid_at__quarter
MIN(subq_1.booking__paid_at__quarter) AS booking__paid_at__quarter__min
, MAX(subq_1.booking__paid_at__quarter) AS booking__paid_at__quarter__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__quarter']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__quarter) AS min_booking__paid_at__quarter
, MAX(booking__paid_at__quarter) AS max_booking__paid_at__quarter
MIN(booking__paid_at__quarter) AS booking__paid_at__quarter__min
, MAX(booking__paid_at__quarter) AS booking__paid_at__quarter__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.listing__country_latest) AS min_listing__country_latest
, MAX(subq_1.listing__country_latest) AS max_listing__country_latest
MIN(subq_1.listing__country_latest) AS listing__country_latest__min
, MAX(subq_1.listing__country_latest) AS listing__country_latest__max
FROM (
-- Pass Only Elements:
-- ['listing__country_latest']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(listing__country_latest) AS min_listing__country_latest
, MAX(listing__country_latest) AS max_listing__country_latest
MIN(listing__country_latest) AS listing__country_latest__min
, MAX(listing__country_latest) AS listing__country_latest__max
FROM (
-- Read Elements From Semantic Model 'listings_latest'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__day) AS min_booking__paid_at__day
, MAX(subq_1.booking__paid_at__day) AS max_booking__paid_at__day
MIN(subq_1.booking__paid_at__day) AS booking__paid_at__day__min
, MAX(subq_1.booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__day']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__day) AS min_booking__paid_at__day
, MAX(booking__paid_at__day) AS max_booking__paid_at__day
MIN(booking__paid_at__day) AS booking__paid_at__day__min
, MAX(booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__quarter) AS min_booking__paid_at__quarter
, MAX(subq_1.booking__paid_at__quarter) AS max_booking__paid_at__quarter
MIN(subq_1.booking__paid_at__quarter) AS booking__paid_at__quarter__min
, MAX(subq_1.booking__paid_at__quarter) AS booking__paid_at__quarter__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__quarter']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__quarter) AS min_booking__paid_at__quarter
, MAX(booking__paid_at__quarter) AS max_booking__paid_at__quarter
MIN(booking__paid_at__quarter) AS booking__paid_at__quarter__min
, MAX(booking__paid_at__quarter) AS booking__paid_at__quarter__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.listing__country_latest) AS min_listing__country_latest
, MAX(subq_1.listing__country_latest) AS max_listing__country_latest
MIN(subq_1.listing__country_latest) AS listing__country_latest__min
, MAX(subq_1.listing__country_latest) AS listing__country_latest__max
FROM (
-- Pass Only Elements:
-- ['listing__country_latest']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(listing__country_latest) AS min_listing__country_latest
, MAX(listing__country_latest) AS max_listing__country_latest
MIN(listing__country_latest) AS listing__country_latest__min
, MAX(listing__country_latest) AS listing__country_latest__max
FROM (
-- Read Elements From Semantic Model 'listings_latest'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__day) AS min_booking__paid_at__day
, MAX(subq_1.booking__paid_at__day) AS max_booking__paid_at__day
MIN(subq_1.booking__paid_at__day) AS booking__paid_at__day__min
, MAX(subq_1.booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__day']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__day) AS min_booking__paid_at__day
, MAX(booking__paid_at__day) AS max_booking__paid_at__day
MIN(booking__paid_at__day) AS booking__paid_at__day__min
, MAX(booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__quarter) AS min_booking__paid_at__quarter
, MAX(subq_1.booking__paid_at__quarter) AS max_booking__paid_at__quarter
MIN(subq_1.booking__paid_at__quarter) AS booking__paid_at__quarter__min
, MAX(subq_1.booking__paid_at__quarter) AS booking__paid_at__quarter__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__quarter']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__quarter) AS min_booking__paid_at__quarter
, MAX(booking__paid_at__quarter) AS max_booking__paid_at__quarter
MIN(booking__paid_at__quarter) AS booking__paid_at__quarter__min
, MAX(booking__paid_at__quarter) AS booking__paid_at__quarter__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.listing__country_latest) AS min_listing__country_latest
, MAX(subq_1.listing__country_latest) AS max_listing__country_latest
MIN(subq_1.listing__country_latest) AS listing__country_latest__min
, MAX(subq_1.listing__country_latest) AS listing__country_latest__max
FROM (
-- Pass Only Elements:
-- ['listing__country_latest']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(listing__country_latest) AS min_listing__country_latest
, MAX(listing__country_latest) AS max_listing__country_latest
MIN(listing__country_latest) AS listing__country_latest__min
, MAX(listing__country_latest) AS listing__country_latest__max
FROM (
-- Read Elements From Semantic Model 'listings_latest'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__day) AS min_booking__paid_at__day
, MAX(subq_1.booking__paid_at__day) AS max_booking__paid_at__day
MIN(subq_1.booking__paid_at__day) AS booking__paid_at__day__min
, MAX(subq_1.booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__day']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__day) AS min_booking__paid_at__day
, MAX(booking__paid_at__day) AS max_booking__paid_at__day
MIN(booking__paid_at__day) AS booking__paid_at__day__min
, MAX(booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__quarter) AS min_booking__paid_at__quarter
, MAX(subq_1.booking__paid_at__quarter) AS max_booking__paid_at__quarter
MIN(subq_1.booking__paid_at__quarter) AS booking__paid_at__quarter__min
, MAX(subq_1.booking__paid_at__quarter) AS booking__paid_at__quarter__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__quarter']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__quarter) AS min_booking__paid_at__quarter
, MAX(booking__paid_at__quarter) AS max_booking__paid_at__quarter
MIN(booking__paid_at__quarter) AS booking__paid_at__quarter__min
, MAX(booking__paid_at__quarter) AS booking__paid_at__quarter__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.listing__country_latest) AS min_listing__country_latest
, MAX(subq_1.listing__country_latest) AS max_listing__country_latest
MIN(subq_1.listing__country_latest) AS listing__country_latest__min
, MAX(subq_1.listing__country_latest) AS listing__country_latest__max
FROM (
-- Pass Only Elements:
-- ['listing__country_latest']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(listing__country_latest) AS min_listing__country_latest
, MAX(listing__country_latest) AS max_listing__country_latest
MIN(listing__country_latest) AS listing__country_latest__min
, MAX(listing__country_latest) AS listing__country_latest__max
FROM (
-- Read Elements From Semantic Model 'listings_latest'
-- Pass Only Elements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(subq_1.booking__paid_at__day) AS min_booking__paid_at__day
, MAX(subq_1.booking__paid_at__day) AS max_booking__paid_at__day
MIN(subq_1.booking__paid_at__day) AS booking__paid_at__day__min
, MAX(subq_1.booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Pass Only Elements:
-- ['booking__paid_at__day']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Calculate min and max
SELECT
MIN(booking__paid_at__day) AS min_booking__paid_at__day
, MAX(booking__paid_at__day) AS max_booking__paid_at__day
MIN(booking__paid_at__day) AS booking__paid_at__day__min
, MAX(booking__paid_at__day) AS booking__paid_at__day__max
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Pass Only Elements:
Expand Down
Loading

0 comments on commit 4cfbbcc

Please sign in to comment.