From 73396b16cf7174debddf61beef1be6b2f0975f7f Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Wed, 20 Sep 2023 12:48:35 -0700 Subject: [PATCH 1/4] Re-add validation to the manifests used for testing. --- metricflow/test/fixtures/model_fixtures.py | 73 ++++++++-------------- 1 file changed, 27 insertions(+), 46 deletions(-) diff --git a/metricflow/test/fixtures/model_fixtures.py b/metricflow/test/fixtures/model_fixtures.py index 6d7fcea2ce..c863a1eb00 100644 --- a/metricflow/test/fixtures/model_fixtures.py +++ b/metricflow/test/fixtures/model_fixtures.py @@ -4,10 +4,12 @@ import os from collections import OrderedDict from dataclasses import dataclass -from typing import Dict, List, Sequence +from typing import Dict, List, Optional, Sequence import pytest +from dbt_semantic_interfaces.implementations.semantic_manifest import PydanticSemanticManifest from dbt_semantic_interfaces.parsing.dir_to_model import ( + SemanticManifestBuildResult, parse_directory_of_yaml_files_to_semantic_manifest, parse_yaml_files_to_validation_ready_semantic_manifest, ) @@ -148,6 +150,20 @@ def create_data_sets( return data_sets +def load_semantic_manifest( + relative_manifest_path: str, + template_mapping: Optional[Dict[str, str]] = None, +) -> SemanticManifestBuildResult: + """Reads the manifest YAMLs from the standard location, applies transformations, runs validations.""" + yaml_file_directory = os.path.join(os.path.dirname(__file__), f"semantic_manifest_yamls/{relative_manifest_path}") + build_result = parse_directory_of_yaml_files_to_semantic_manifest( + yaml_file_directory, template_mapping=template_mapping + ) + validator = SemanticManifestValidator[PydanticSemanticManifest]() + validator.checked_validations(build_result.semantic_manifest) + return build_result + + @pytest.fixture(scope="session") def template_mapping(mf_test_session_state: MetricFlowTestSessionState) -> Dict[str, str]: """Mapping for template variables in the model YAML files.""" @@ -156,30 +172,19 @@ def template_mapping(mf_test_session_state: MetricFlowTestSessionState) -> Dict[ @pytest.fixture(scope="session") def simple_semantic_manifest_lookup_non_ds(template_mapping: Dict[str, str]) -> SemanticManifestLookup: # noqa: D - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - os.path.join(os.path.dirname(__file__), "semantic_manifest_yamls/non_sm_manifest"), - template_mapping=template_mapping, - ) + build_result = load_semantic_manifest("non_sm_manifest", template_mapping) return SemanticManifestLookup(build_result.semantic_manifest) @pytest.fixture(scope="session") def simple_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> SemanticManifestLookup: # noqa: D - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - os.path.join(os.path.dirname(__file__), "semantic_manifest_yamls/simple_manifest"), - template_mapping=template_mapping, - ) + build_result = load_semantic_manifest("simple_manifest", template_mapping) return SemanticManifestLookup(build_result.semantic_manifest) @pytest.fixture(scope="session") def multi_hop_join_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> SemanticManifestLookup: # noqa: D - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - os.path.join( - os.path.dirname(__file__), "semantic_manifest_yamls/multi_hop_join_manifest/partitioned_semantic_models" - ), - template_mapping=template_mapping, - ) + build_result = load_semantic_manifest("multi_hop_join_manifest/partitioned_semantic_models", template_mapping) return SemanticManifestLookup(build_result.semantic_manifest) @@ -187,33 +192,21 @@ def multi_hop_join_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> def unpartitioned_multi_hop_join_semantic_manifest_lookup( # noqa: D template_mapping: Dict[str, str] ) -> SemanticManifestLookup: - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - os.path.join( - os.path.dirname(__file__), "semantic_manifest_yamls/multi_hop_join_manifest/unpartitioned_semantic_models" - ), - template_mapping=template_mapping, - ) + build_result = load_semantic_manifest("multi_hop_join_manifest/unpartitioned_semantic_models", template_mapping) return SemanticManifestLookup(build_result.semantic_manifest) @pytest.fixture(scope="session") def simple_semantic_manifest(template_mapping: Dict[str, str]) -> SemanticManifest: """Model used for many tests.""" - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - os.path.join(os.path.dirname(__file__), "semantic_manifest_yamls/simple_manifest"), - template_mapping=template_mapping, - ) + build_result = load_semantic_manifest("simple_manifest", template_mapping) return build_result.semantic_manifest @pytest.fixture(scope="session") def simple_model__with_primary_transforms(template_mapping: Dict[str, str]) -> SemanticManifest: """Model used for tests pre-transformations.""" - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - os.path.join(os.path.dirname(__file__), "semantic_manifest_yamls/simple_manifest"), - template_mapping=template_mapping, - apply_transformations=False, - ) + build_result = load_semantic_manifest("simple_manifest", template_mapping) transformed_model = PydanticSemanticManifestTransformer().transform( model=build_result.semantic_manifest, ordered_rule_sequences=(PydanticSemanticManifestTransformRuleSet().primary_rules,), @@ -223,38 +216,26 @@ def simple_model__with_primary_transforms(template_mapping: Dict[str, str]) -> S @pytest.fixture(scope="session") def extended_date_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> SemanticManifestLookup: # noqa: D - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - os.path.join(os.path.dirname(__file__), "semantic_manifest_yamls/extended_date_manifest"), - template_mapping=template_mapping, - ) + build_result = load_semantic_manifest("extended_date_manifest", template_mapping) return SemanticManifestLookup(build_result.semantic_manifest) @pytest.fixture(scope="session") def scd_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> SemanticManifestLookup: """Initialize semantic model for SCD tests.""" - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - os.path.join(os.path.dirname(__file__), "semantic_manifest_yamls/scd_manifest"), - template_mapping=template_mapping, - ) + build_result = load_semantic_manifest("scd_manifest", template_mapping) return SemanticManifestLookup(build_result.semantic_manifest) @pytest.fixture(scope="session") def data_warehouse_validation_model(template_mapping: Dict[str, str]) -> SemanticManifest: """Model used for data warehouse validation tests.""" - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - os.path.join(os.path.dirname(__file__), "semantic_manifest_yamls/data_warehouse_validation_manifest"), - template_mapping=template_mapping, - ) + build_result = load_semantic_manifest("data_warehouse_validation_manifest", template_mapping) return build_result.semantic_manifest @pytest.fixture(scope="session") def cyclic_join_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> SemanticManifestLookup: """Manifest that contains a potential cycle in the join graph (if not handled properly).""" - build_result = parse_directory_of_yaml_files_to_semantic_manifest( - os.path.join(os.path.dirname(__file__), "semantic_manifest_yamls/cyclic_join_manifest"), - template_mapping=template_mapping, - ) + build_result = load_semantic_manifest("cyclic_join_manifest", template_mapping) return SemanticManifestLookup(build_result.semantic_manifest) From a2dd5cd67ca12638cb2d3d9d4e4685c3bd69724e Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Wed, 20 Sep 2023 12:49:03 -0700 Subject: [PATCH 2/4] Fix issues with manifests as detected by validations. --- .../bookings_from_sql_query_source.yaml | 29 ---------- .../bookings_monthly_source.yaml | 14 +++-- .../extended_bookings_source.yaml | 8 +-- .../listings_extended_source.yaml | 6 +- .../bridge_table.yaml | 4 +- .../scd_manifest/scd_accounts.yaml | 2 + .../semantic_models/users_latest.yaml | 3 +- .../dim_listings_extended.yaml | 2 +- .../fct_bookings_extended.yaml | 2 +- .../fct_bookings_extended_monthly.yaml | 50 ++++++++-------- .../test_cases/itest_granularity.yaml | 57 ++++++++----------- .../test_semantic_model_join_evaluator.py | 8 +-- 12 files changed, 79 insertions(+), 106 deletions(-) delete mode 100644 metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/bookings_from_sql_query_source.yaml diff --git a/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/bookings_from_sql_query_source.yaml b/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/bookings_from_sql_query_source.yaml deleted file mode 100644 index bff5acd3ab..0000000000 --- a/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/bookings_from_sql_query_source.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -semantic_model: - name: bookings_from_sql_query_source - description: bookings_from_sql_query_source - - node_relation: - schema_name: $source_schema - alias: fct_bookings_extended - - defaults: - agg_time_dimension: ds - - measures: - - name: bookings_from_sql_query - expr: booking - agg: sum - create_metric: true - - dimensions: - - name: ds - type: time - type_params: - time_granularity: day - - entities: - - name: booking_id - type: primary - - name: listing_id - type: foreign diff --git a/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/bookings_monthly_source.yaml b/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/bookings_monthly_source.yaml index 7809a53d22..f98fd08d08 100644 --- a/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/bookings_monthly_source.yaml +++ b/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/bookings_monthly_source.yaml @@ -8,19 +8,23 @@ semantic_model: alias: fct_bookings_extended_monthly defaults: - agg_time_dimension: ds + agg_time_dimension: monthly_ds measures: - name: bookings_monthly agg: sum create_metric: true - primary_entity: booking_id + primary_entity: booking dimensions: - - name: ds + - name: monthly_ds + expr: ds type: time type_params: time_granularity: month - - name: is_instant - type: categorical + + entities: + - name: listing + expr: listing_id + type: foreign diff --git a/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/extended_bookings_source.yaml b/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/extended_bookings_source.yaml index 72bb210587..1158cf5ad5 100644 --- a/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/extended_bookings_source.yaml +++ b/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/extended_bookings_source.yaml @@ -25,11 +25,11 @@ semantic_model: type: time type_params: time_granularity: day - - name: is_instant - type: categorical entities: - - name: booking_id + - name: booking + expr: booking_id type: primary - - name: listing_id + - name: listing + expr: listing_id type: foreign diff --git a/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/listings_extended_source.yaml b/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/listings_extended_source.yaml index 6baf1a14c6..6b18edb526 100644 --- a/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/listings_extended_source.yaml +++ b/metricflow/test/fixtures/semantic_manifest_yamls/extended_date_manifest/semantic_models/listings_extended_source.yaml @@ -8,11 +8,13 @@ semantic_model: alias: dim_listings_extended dimensions: - - name: listing_creation_ds + - name: ds + expr: listing_creation_ds type: time type_params: time_granularity: day entities: - - name: listing_id + - name: listing + expr: listing_id type: primary diff --git a/metricflow/test/fixtures/semantic_manifest_yamls/multi_hop_join_manifest/partitioned_semantic_models/bridge_table.yaml b/metricflow/test/fixtures/semantic_manifest_yamls/multi_hop_join_manifest/partitioned_semantic_models/bridge_table.yaml index 7dc099c9c7..3f804148fb 100644 --- a/metricflow/test/fixtures/semantic_manifest_yamls/multi_hop_join_manifest/partitioned_semantic_models/bridge_table.yaml +++ b/metricflow/test/fixtures/semantic_manifest_yamls/multi_hop_join_manifest/partitioned_semantic_models/bridge_table.yaml @@ -16,8 +16,10 @@ semantic_model: time_granularity: day is_partition: true + primary_entity: bridge_account + entities: - name: account_id - type: primary + type: unique - name: customer_id type: foreign diff --git a/metricflow/test/fixtures/semantic_manifest_yamls/scd_manifest/scd_accounts.yaml b/metricflow/test/fixtures/semantic_manifest_yamls/scd_manifest/scd_accounts.yaml index 1387a557d0..6753051366 100644 --- a/metricflow/test/fixtures/semantic_manifest_yamls/scd_manifest/scd_accounts.yaml +++ b/metricflow/test/fixtures/semantic_manifest_yamls/scd_manifest/scd_accounts.yaml @@ -25,6 +25,8 @@ semantic_model: - name: account_type type: categorical + primary_entity: scd_user + entities: - name: user type: natural diff --git a/metricflow/test/fixtures/semantic_manifest_yamls/simple_manifest/semantic_models/users_latest.yaml b/metricflow/test/fixtures/semantic_manifest_yamls/simple_manifest/semantic_models/users_latest.yaml index d85c37b44b..44134d966b 100644 --- a/metricflow/test/fixtures/semantic_manifest_yamls/simple_manifest/semantic_models/users_latest.yaml +++ b/metricflow/test/fixtures/semantic_manifest_yamls/simple_manifest/semantic_models/users_latest.yaml @@ -8,8 +8,9 @@ semantic_model: alias: dim_users_latest dimensions: - - name: ds + - name: ds_latest type: time + expr: ds type_params: time_granularity: day - name: home_state_latest diff --git a/metricflow/test/fixtures/source_table_snapshots/extended_date_model/dim_listings_extended.yaml b/metricflow/test/fixtures/source_table_snapshots/extended_date_model/dim_listings_extended.yaml index 05b68cb033..3f5f45351f 100644 --- a/metricflow/test/fixtures/source_table_snapshots/extended_date_model/dim_listings_extended.yaml +++ b/metricflow/test/fixtures/source_table_snapshots/extended_date_model/dim_listings_extended.yaml @@ -4,7 +4,7 @@ table_snapshot: - name: listing_creation_ds type: TIME - name: listing_id - type: INT + type: STRING rows: - ["2020-01-01", "0"] - ["2020-01-02", "1"] diff --git a/metricflow/test/fixtures/source_table_snapshots/extended_date_model/fct_bookings_extended.yaml b/metricflow/test/fixtures/source_table_snapshots/extended_date_model/fct_bookings_extended.yaml index d30fd0533d..69520f4157 100644 --- a/metricflow/test/fixtures/source_table_snapshots/extended_date_model/fct_bookings_extended.yaml +++ b/metricflow/test/fixtures/source_table_snapshots/extended_date_model/fct_bookings_extended.yaml @@ -8,7 +8,7 @@ table_snapshot: - name: booking type: INT - name: listing_id - type: INT + type: STRING - name: is_instant type: BOOLEAN rows: diff --git a/metricflow/test/fixtures/source_table_snapshots/extended_date_model/fct_bookings_extended_monthly.yaml b/metricflow/test/fixtures/source_table_snapshots/extended_date_model/fct_bookings_extended_monthly.yaml index 3b470773d9..29a4ac5bca 100644 --- a/metricflow/test/fixtures/source_table_snapshots/extended_date_model/fct_bookings_extended_monthly.yaml +++ b/metricflow/test/fixtures/source_table_snapshots/extended_date_model/fct_bookings_extended_monthly.yaml @@ -7,28 +7,30 @@ table_snapshot: type: INT - name: is_instant type: BOOLEAN + - name: listing_id + type: STRING rows: - - ["2020-01-01", "10", "True"] - - ["2020-01-01", "5", "False"] - - ["2020-02-01", "10", "True"] - - ["2020-02-01", "5", "False"] - - ["2020-03-01", "10", "True"] - - ["2020-03-01", "5", "False"] - - ["2020-04-01", "10", "True"] - - ["2020-04-01", "5", "False"] - - ["2020-05-01", "10", "True"] - - ["2020-05-01", "5", "False"] - - ["2020-06-01", "10", "True"] - - ["2020-06-01", "5", "False"] - - ["2020-07-01", "10", "True"] - - ["2020-07-01", "5", "False"] - - ["2020-08-01", "10", "True"] - - ["2020-08-01", "5", "False"] - - ["2020-09-01", "10", "True"] - - ["2020-09-01", "5", "False"] - - ["2020-10-01", "10", "True"] - - ["2020-10-01", "5", "False"] - - ["2020-11-01", "10", "True"] - - ["2020-11-01", "5", "False"] - - ["2020-12-01", "10", "True"] - - ["2020-12-01", "5", "False"] + - ["2020-01-01", "10", "True", "0"] + - ["2020-01-01", "5", "False", "1"] + - ["2020-02-01", "10", "True", "2"] + - ["2020-02-01", "5", "False", "3"] + - ["2020-03-01", "10", "True", "4"] + - ["2020-03-01", "5", "False", "5"] + - ["2020-04-01", "10", "True", "6"] + - ["2020-04-01", "5", "False", "7"] + - ["2020-05-01", "10", "True", "8"] + - ["2020-05-01", "5", "False", "9"] + - ["2020-06-01", "10", "True", "0"] + - ["2020-06-01", "5", "False", "0"] + - ["2020-07-01", "10", "True", "1"] + - ["2020-07-01", "5", "False", "2"] + - ["2020-08-01", "10", "True", "3"] + - ["2020-08-01", "5", "False", "4"] + - ["2020-09-01", "10", "True", "5"] + - ["2020-09-01", "5", "False", "6"] + - ["2020-10-01", "10", "True", "7"] + - ["2020-10-01", "5", "False", "8"] + - ["2020-11-01", "10", "True", "9"] + - ["2020-11-01", "5", "False", "0"] + - ["2020-12-01", "10", "True", "0"] + - ["2020-12-01", "5", "False", "1"] diff --git a/metricflow/test/integration/test_cases/itest_granularity.yaml b/metricflow/test/integration/test_cases/itest_granularity.yaml index 3c7da50078..7aee578af1 100644 --- a/metricflow/test/integration/test_cases/itest_granularity.yaml +++ b/metricflow/test/integration/test_cases/itest_granularity.yaml @@ -144,46 +144,32 @@ integration_test: description: Query a count distinct metric by time granularities. model: EXTENDED_DATE_MODEL metrics: ["bookings"] - group_bys: ["listing_id__listing_creation_ds__day"] + group_bys: ["listing__ds__day"] check_query: | SELECT SUM(booking) AS bookings - , {{ render_date_trunc("ds", TimeGranularity.DAY) }} AS listing_id__listing_creation_ds__day + , {{ render_date_trunc("ds", TimeGranularity.DAY) }} AS listing__ds__day FROM {{ source_schema }}.fct_bookings_extended b LEFT OUTER JOIN {{ source_schema }}.dim_listings_extended l ON b.listing_id = l.listing_id GROUP BY - listing_id__listing_creation_ds__day + 2 --- integration_test: name: query_granularity_for_joined_dundered_dimension_month description: Query a count distinct metric by time granularities. model: EXTENDED_DATE_MODEL metrics: ["bookings"] - group_bys: ["listing_id__listing_creation_ds__month"] + group_bys: ["listing__ds__month"] check_query: | SELECT SUM(booking) AS bookings - , {{ render_date_trunc("l.listing_creation_ds", TimeGranularity.MONTH) }} AS listing_id__listing_creation_ds__month + , {{ render_date_trunc("l.listing_creation_ds", TimeGranularity.MONTH) }} AS listing__ds__month FROM {{ source_schema }}.fct_bookings_extended b LEFT OUTER JOIN {{ source_schema }}.dim_listings_extended l ON b.listing_id = l.listing_id GROUP BY - listing_id__listing_creation_ds__month ---- -integration_test: - name: query_granularity_from_sql_query - description: Query a metric from a sql query by time granularities. - model: EXTENDED_DATE_MODEL - metrics: ["bookings_from_sql_query"] - group_bys: ["metric_time__week"] - check_query: | - SELECT - SUM(booking) AS bookings_from_sql_query - , {{ render_date_trunc("ds", TimeGranularity.WEEK) }} AS metric_time__week - FROM {{ source_schema }}.fct_bookings_extended - GROUP BY - metric_time__week + 2 --- integration_test: name: metric_with_non_day_granularity_expected_boundary @@ -290,34 +276,37 @@ integration_test: metric_time__month --- integration_test: - name: metrics_with_different_time_granularities_and_no_time_dim - description: Query two metrics with different time granularities, but without a time dimension. + name: metrics_with_different_time_granularities_and_no_metric_time + description: Query two metrics with different time granularities with a common dimension, but no metric time. model: EXTENDED_DATE_MODEL metrics: ["bookings_monthly", "bookings"] - group_bys: ["booking_id__is_instant"] + group_bys: ["listing__ds"] time_constraint: ["2020-01-15", "2020-02-15"] check_query: | SELECT - SUM(bookings_monthly) AS bookings_monthly - , SUM(bookings) AS bookings - , a.is_instant AS booking_id__is_instant + a.bookings_monthly AS bookings_monthly + , b.bookings AS bookings + , COALESCE(a.listing__ds__day, b.listing__ds__day) AS listing__ds__day FROM ( SELECT SUM(bookings_monthly) AS bookings_monthly - , is_instant - FROM {{ source_schema }}.fct_bookings_extended_monthly + , l.listing_creation_ds AS listing__ds__day + FROM {{ source_schema }}.fct_bookings_extended_monthly b + LEFT OUTER JOIN {{ source_schema }}.dim_listings_extended l + ON b.listing_id = l.listing_id WHERE {{ render_time_constraint("ds", "2020-01-01", "2020-02-29") }} - GROUP BY is_instant + GROUP BY 2 ) a FULL OUTER JOIN ( SELECT SUM(booking) AS bookings - , is_instant - FROM {{ source_schema }}.fct_bookings_extended + , l.listing_creation_ds AS listing__ds__day + FROM {{ source_schema }}.fct_bookings_extended b + LEFT OUTER JOIN {{ source_schema }}.dim_listings_extended l + ON b.listing_id = l.listing_id WHERE {{ render_time_constraint("ds", "2020-01-01", "2020-02-29") }} - GROUP BY is_instant + GROUP BY 2 ) b - ON a.is_instant = b.is_instant - GROUP BY a.is_instant + ON a.listing__ds__day = b.listing__ds__day diff --git a/metricflow/test/model/semantics/test_semantic_model_join_evaluator.py b/metricflow/test/model/semantics/test_semantic_model_join_evaluator.py index b888ce8293..e483facc58 100644 --- a/metricflow/test/model/semantics/test_semantic_model_join_evaluator.py +++ b/metricflow/test/model/semantics/test_semantic_model_join_evaluator.py @@ -325,7 +325,7 @@ def test_get_joinable_semantic_models_single_hop( # noqa: D right_semantic_model_reference=SemanticModelReference(semantic_model_name="bridge_table"), entity_reference=EntityReference(element_name="account_id"), join_type=SemanticModelEntityJoinType( - left_entity_type=EntityType.PRIMARY, right_entity_type=EntityType.PRIMARY + left_entity_type=EntityType.PRIMARY, right_entity_type=EntityType.UNIQUE ), ) ], @@ -352,7 +352,7 @@ def test_get_joinable_semantic_models_multi_hop( # noqa: D right_semantic_model_reference=SemanticModelReference(semantic_model_name="bridge_table"), entity_reference=EntityReference(element_name="account_id"), join_type=SemanticModelEntityJoinType( - left_entity_type=EntityType.PRIMARY, right_entity_type=EntityType.PRIMARY + left_entity_type=EntityType.PRIMARY, right_entity_type=EntityType.UNIQUE ), ) ], @@ -364,7 +364,7 @@ def test_get_joinable_semantic_models_multi_hop( # noqa: D right_semantic_model_reference=SemanticModelReference(semantic_model_name="bridge_table"), entity_reference=EntityReference(element_name="account_id"), join_type=SemanticModelEntityJoinType( - left_entity_type=EntityType.PRIMARY, right_entity_type=EntityType.PRIMARY + left_entity_type=EntityType.PRIMARY, right_entity_type=EntityType.UNIQUE ), ), SemanticModelEntityJoin( @@ -383,7 +383,7 @@ def test_get_joinable_semantic_models_multi_hop( # noqa: D right_semantic_model_reference=SemanticModelReference(semantic_model_name="bridge_table"), entity_reference=EntityReference(element_name="account_id"), join_type=SemanticModelEntityJoinType( - left_entity_type=EntityType.PRIMARY, right_entity_type=EntityType.PRIMARY + left_entity_type=EntityType.PRIMARY, right_entity_type=EntityType.UNIQUE ), ), SemanticModelEntityJoin( From ff51ec88153f0707c40d6123af2eb9288586b0cd Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Wed, 2 Aug 2023 17:28:05 -0700 Subject: [PATCH 3/4] Migrate data set conversion test to use snapshots. This makes tests easier to fix after a changes to semantic models. --- .../dataset/test_convert_semantic_model.py | 357 +----------------- 1 file changed, 11 insertions(+), 346 deletions(-) diff --git a/metricflow/test/dataset/test_convert_semantic_model.py b/metricflow/test/dataset/test_convert_semantic_model.py index 747510ff6e..069b7d4094 100644 --- a/metricflow/test/dataset/test_convert_semantic_model.py +++ b/metricflow/test/dataset/test_convert_semantic_model.py @@ -4,22 +4,13 @@ from _pytest.fixtures import FixtureRequest from dbt_semantic_interfaces.references import SemanticModelReference -from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity from metricflow.protocols.sql_client import SqlClient -from metricflow.specs.specs import ( - DimensionSpec, - EntityReference, - EntitySpec, - InstanceSpecSet, - MeasureSpec, - TimeDimensionSpec, -) from metricflow.sql.render.sql_plan_renderer import SqlQueryPlanRenderer from metricflow.test.fixtures.model_fixtures import ConsistentIdObjectRepository from metricflow.test.fixtures.setup_fixtures import MetricFlowTestSessionState +from metricflow.test.snapshot_utils import assert_spec_set_snapshot_equal from metricflow.test.sql.compare_sql_plan import assert_rendered_sql_equal -from metricflow.time.date_part import DatePart logger = logging.getLogger(__name__) @@ -33,115 +24,12 @@ def test_convert_table_semantic_model_without_measures( # noqa: D """Simple test for converting a table semantic model. Since there are no measures, primary time is not checked.""" users_data_set = consistent_id_object_repository.simple_model_data_sets["users_latest"] - expected_spec_set = InstanceSpecSet( - metric_specs=(), - measure_specs=(), - dimension_specs=( - DimensionSpec(element_name="home_state_latest", entity_links=()), - DimensionSpec( - element_name="home_state_latest", - entity_links=(EntityReference(element_name="user"),), - ), - ), - entity_specs=(EntitySpec(element_name="user", entity_links=()),), - time_dimension_specs=( - TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY), - TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.WEEK), - TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.MONTH), - TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.QUARTER), - TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.YEAR), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.YEAR - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.QUARTER - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.MONTH - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.WEEK - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DAY - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DOY - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.DAY, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.WEEK, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.MONTH, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.QUARTER, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.YEAR, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.YEAR, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.QUARTER, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.MONTH, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.WEEK, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DAY, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DOW, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="user"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DOY, - ), - ), + assert_spec_set_snapshot_equal( + request=request, + mf_test_session_state=mf_test_session_state, + set_id="result0", + spec_set=users_data_set.instance_set.spec_set, ) - - assert users_data_set.instance_set.spec_set == expected_spec_set assert users_data_set.semantic_model_reference == SemanticModelReference(semantic_model_name="users_latest") assert_rendered_sql_equal( request=request, @@ -165,236 +53,13 @@ def test_convert_table_semantic_model_with_measures( # noqa: D """ id_verifications_data_set = consistent_id_object_repository.simple_model_data_sets["id_verifications"] - expected_spec_set = InstanceSpecSet( - metric_specs=(), - measure_specs=(MeasureSpec(element_name="identity_verifications"),), - dimension_specs=( - DimensionSpec(element_name="verification_type", entity_links=()), - DimensionSpec( - element_name="verification_type", - entity_links=(EntityReference(element_name="verification"),), - ), - ), - entity_specs=( - EntitySpec(element_name="verification", entity_links=()), - EntitySpec(element_name="user", entity_links=()), - EntitySpec( - element_name="user", - entity_links=(EntityReference(element_name="verification"),), - ), - ), - time_dimension_specs=( - TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY), - TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.WEEK), - TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.MONTH), - TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.QUARTER), - TimeDimensionSpec(element_name="ds", entity_links=(), time_granularity=TimeGranularity.YEAR), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.YEAR - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.QUARTER - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.MONTH - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.WEEK - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DAY - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DOW - ), - TimeDimensionSpec( - element_name="ds", entity_links=(), time_granularity=TimeGranularity.DAY, date_part=DatePart.DOY - ), - TimeDimensionSpec(element_name="ds_partitioned", entity_links=(), time_granularity=TimeGranularity.DAY), - TimeDimensionSpec(element_name="ds_partitioned", entity_links=(), time_granularity=TimeGranularity.WEEK), - TimeDimensionSpec(element_name="ds_partitioned", entity_links=(), time_granularity=TimeGranularity.MONTH), - TimeDimensionSpec(element_name="ds_partitioned", entity_links=(), time_granularity=TimeGranularity.QUARTER), - TimeDimensionSpec(element_name="ds_partitioned", entity_links=(), time_granularity=TimeGranularity.YEAR), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.YEAR, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.QUARTER, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.MONTH, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.WEEK, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DAY, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DOW, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DOY, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.WEEK, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.MONTH, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.QUARTER, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.YEAR, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.YEAR, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.QUARTER, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.MONTH, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.WEEK, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DAY, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DOW, - ), - TimeDimensionSpec( - element_name="ds", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DOY, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.WEEK, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.MONTH, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.QUARTER, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.YEAR, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.YEAR, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.QUARTER, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.MONTH, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.WEEK, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DAY, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DOW, - ), - TimeDimensionSpec( - element_name="ds_partitioned", - entity_links=(EntityReference(element_name="verification"),), - time_granularity=TimeGranularity.DAY, - date_part=DatePart.DOY, - ), - ), + assert_spec_set_snapshot_equal( + request=request, + mf_test_session_state=mf_test_session_state, + set_id="result0", + spec_set=id_verifications_data_set.instance_set.spec_set, ) - assert id_verifications_data_set.instance_set.spec_set == expected_spec_set assert id_verifications_data_set.semantic_model_reference == SemanticModelReference( semantic_model_name="id_verifications" ) From 8cf1790d9059d4ced02ae2bf16fccf7c3a1124b8 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Tue, 8 Aug 2023 15:55:59 -0700 Subject: [PATCH 4/4] Update test snapshots. --- ...semantic_model_without_measures__plan0.sql | 48 +- ...semantic_model_without_measures__plan0.sql | 48 +- ...semantic_model_without_measures__plan0.sql | 48 +- ...semantic_model_without_measures__plan0.sql | 48 +- ...semantic_model_without_measures__plan0.sql | 48 +- ...semantic_model_without_measures__plan0.sql | 48 +- ..._semantic_model_with_measures__result0.txt | 54 ++ ...mantic_model_without_measures__result0.txt | 27 + .../BigQuery/test_multihop_node__plan0.sql | 30 + .../Databricks/test_multihop_node__plan0.sql | 30 + .../DuckDB/test_multihop_node__plan0.sql | 30 + .../Postgres/test_multihop_node__plan0.sql | 30 + .../Redshift/test_multihop_node__plan0.sql | 30 + .../Snowflake/test_multihop_node__plan0.sql | 30 + .../test_join_to_scd_dimension__plan0.xml | 286 +++++----- ...multi_hop_through_scd_dimension__plan0.xml | 340 +++++------ ...test_multi_hop_to_scd_dimension__plan0.xml | 280 +++++----- .../test_multihop_node__plan0.xml | 526 +++++++++++------- .../str/test_all_properties__result0.txt | 10 + .../test_joined_node_data_set__result0.txt | 24 +- .../dict/test_get_names__result0.txt | 1 + .../str/test_linkable_set__result0.txt | 4 + ...imensions_in_different_models__result0.txt | 2 + .../test_elements_for_metric__result0.txt | 4 + 24 files changed, 1214 insertions(+), 812 deletions(-) create mode 100644 metricflow/test/snapshots/test_convert_semantic_model.py/list/test_convert_table_semantic_model_with_measures__result0.txt create mode 100644 metricflow/test/snapshots/test_convert_semantic_model.py/list/test_convert_table_semantic_model_without_measures__result0.txt diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql index abec542070..e78994d824 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,30 +1,30 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - users_latest_src_10008.ds AS ds__day - , DATE_TRUNC(users_latest_src_10008.ds, isoweek) AS ds__week - , DATE_TRUNC(users_latest_src_10008.ds, month) AS ds__month - , DATE_TRUNC(users_latest_src_10008.ds, quarter) AS ds__quarter - , DATE_TRUNC(users_latest_src_10008.ds, year) AS ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS ds__extract_month - , EXTRACT(isoweek FROM users_latest_src_10008.ds) AS ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS ds__extract_day - , EXTRACT(dayofweek FROM users_latest_src_10008.ds) AS ds__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10008.ds) AS ds__extract_doy + users_latest_src_10008.ds AS ds_latest__day + , DATE_TRUNC(users_latest_src_10008.ds, isoweek) AS ds_latest__week + , DATE_TRUNC(users_latest_src_10008.ds, month) AS ds_latest__month + , DATE_TRUNC(users_latest_src_10008.ds, quarter) AS ds_latest__quarter + , DATE_TRUNC(users_latest_src_10008.ds, year) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS ds_latest__extract_month + , EXTRACT(isoweek FROM users_latest_src_10008.ds) AS ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS ds_latest__extract_day + , EXTRACT(dayofweek FROM users_latest_src_10008.ds) AS ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_10008.ds) AS ds_latest__extract_doy , users_latest_src_10008.home_state_latest - , users_latest_src_10008.ds AS user__ds__day - , DATE_TRUNC(users_latest_src_10008.ds, isoweek) AS user__ds__week - , DATE_TRUNC(users_latest_src_10008.ds, month) AS user__ds__month - , DATE_TRUNC(users_latest_src_10008.ds, quarter) AS user__ds__quarter - , DATE_TRUNC(users_latest_src_10008.ds, year) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds__extract_month - , EXTRACT(isoweek FROM users_latest_src_10008.ds) AS user__ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds__extract_day - , EXTRACT(dayofweek FROM users_latest_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(dayofyear FROM users_latest_src_10008.ds) AS user__ds__extract_doy + , users_latest_src_10008.ds AS user__ds_latest__day + , DATE_TRUNC(users_latest_src_10008.ds, isoweek) AS user__ds_latest__week + , DATE_TRUNC(users_latest_src_10008.ds, month) AS user__ds_latest__month + , DATE_TRUNC(users_latest_src_10008.ds, quarter) AS user__ds_latest__quarter + , DATE_TRUNC(users_latest_src_10008.ds, year) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds_latest__extract_month + , EXTRACT(isoweek FROM users_latest_src_10008.ds) AS user__ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds_latest__extract_day + , EXTRACT(dayofweek FROM users_latest_src_10008.ds) AS user__ds_latest__extract_dow + , EXTRACT(dayofyear FROM users_latest_src_10008.ds) AS user__ds_latest__extract_doy , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql index e96f783576..184fc0044a 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,30 +1,30 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - users_latest_src_10008.ds AS ds__day - , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS ds__extract_month - , EXTRACT(week FROM users_latest_src_10008.ds) AS ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS ds__extract_day - , EXTRACT(dow FROM users_latest_src_10008.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds__extract_doy + users_latest_src_10008.ds AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS ds_latest__extract_month + , EXTRACT(week FROM users_latest_src_10008.ds) AS ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS ds_latest__extract_day + , EXTRACT(dow FROM users_latest_src_10008.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds_latest__extract_doy , users_latest_src_10008.home_state_latest - , users_latest_src_10008.ds AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds__extract_month - , EXTRACT(week FROM users_latest_src_10008.ds) AS user__ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds__extract_day - , EXTRACT(dow FROM users_latest_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds__extract_doy + , users_latest_src_10008.ds AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds_latest__extract_month + , EXTRACT(week FROM users_latest_src_10008.ds) AS user__ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds_latest__extract_day + , EXTRACT(dow FROM users_latest_src_10008.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds_latest__extract_doy , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql index e96f783576..184fc0044a 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,30 +1,30 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - users_latest_src_10008.ds AS ds__day - , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS ds__extract_month - , EXTRACT(week FROM users_latest_src_10008.ds) AS ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS ds__extract_day - , EXTRACT(dow FROM users_latest_src_10008.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds__extract_doy + users_latest_src_10008.ds AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS ds_latest__extract_month + , EXTRACT(week FROM users_latest_src_10008.ds) AS ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS ds_latest__extract_day + , EXTRACT(dow FROM users_latest_src_10008.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds_latest__extract_doy , users_latest_src_10008.home_state_latest - , users_latest_src_10008.ds AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds__extract_month - , EXTRACT(week FROM users_latest_src_10008.ds) AS user__ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds__extract_day - , EXTRACT(dow FROM users_latest_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds__extract_doy + , users_latest_src_10008.ds AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds_latest__extract_month + , EXTRACT(week FROM users_latest_src_10008.ds) AS user__ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds_latest__extract_day + , EXTRACT(dow FROM users_latest_src_10008.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds_latest__extract_doy , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql index e96f783576..184fc0044a 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,30 +1,30 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - users_latest_src_10008.ds AS ds__day - , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS ds__extract_month - , EXTRACT(week FROM users_latest_src_10008.ds) AS ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS ds__extract_day - , EXTRACT(dow FROM users_latest_src_10008.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds__extract_doy + users_latest_src_10008.ds AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS ds_latest__extract_month + , EXTRACT(week FROM users_latest_src_10008.ds) AS ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS ds_latest__extract_day + , EXTRACT(dow FROM users_latest_src_10008.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds_latest__extract_doy , users_latest_src_10008.home_state_latest - , users_latest_src_10008.ds AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds__extract_month - , EXTRACT(week FROM users_latest_src_10008.ds) AS user__ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds__extract_day - , EXTRACT(dow FROM users_latest_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds__extract_doy + , users_latest_src_10008.ds AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds_latest__extract_month + , EXTRACT(week FROM users_latest_src_10008.ds) AS user__ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds_latest__extract_day + , EXTRACT(dow FROM users_latest_src_10008.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds_latest__extract_doy , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql index e96f783576..184fc0044a 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,30 +1,30 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - users_latest_src_10008.ds AS ds__day - , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS ds__extract_month - , EXTRACT(week FROM users_latest_src_10008.ds) AS ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS ds__extract_day - , EXTRACT(dow FROM users_latest_src_10008.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds__extract_doy + users_latest_src_10008.ds AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS ds_latest__extract_month + , EXTRACT(week FROM users_latest_src_10008.ds) AS ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS ds_latest__extract_day + , EXTRACT(dow FROM users_latest_src_10008.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds_latest__extract_doy , users_latest_src_10008.home_state_latest - , users_latest_src_10008.ds AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds__extract_month - , EXTRACT(week FROM users_latest_src_10008.ds) AS user__ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds__extract_day - , EXTRACT(dow FROM users_latest_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds__extract_doy + , users_latest_src_10008.ds AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds_latest__extract_month + , EXTRACT(week FROM users_latest_src_10008.ds) AS user__ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds_latest__extract_day + , EXTRACT(dow FROM users_latest_src_10008.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds_latest__extract_doy , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql index e96f783576..184fc0044a 100644 --- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql @@ -1,30 +1,30 @@ -- Read Elements From Semantic Model 'users_latest' SELECT - users_latest_src_10008.ds AS ds__day - , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds__week - , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month - , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter - , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS ds__extract_month - , EXTRACT(week FROM users_latest_src_10008.ds) AS ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS ds__extract_day - , EXTRACT(dow FROM users_latest_src_10008.ds) AS ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds__extract_doy + users_latest_src_10008.ds AS ds_latest__day + , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds_latest__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS ds_latest__extract_month + , EXTRACT(week FROM users_latest_src_10008.ds) AS ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS ds_latest__extract_day + , EXTRACT(dow FROM users_latest_src_10008.ds) AS ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS ds_latest__extract_doy , users_latest_src_10008.home_state_latest - , users_latest_src_10008.ds AS user__ds__day - , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week - , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month - , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter - , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year - , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds__extract_year - , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds__extract_quarter - , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds__extract_month - , EXTRACT(week FROM users_latest_src_10008.ds) AS user__ds__extract_week - , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds__extract_day - , EXTRACT(dow FROM users_latest_src_10008.ds) AS user__ds__extract_dow - , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds__extract_doy + , users_latest_src_10008.ds AS user__ds_latest__day + , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds_latest__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds_latest__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds_latest__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds_latest__year + , EXTRACT(year FROM users_latest_src_10008.ds) AS user__ds_latest__extract_year + , EXTRACT(quarter FROM users_latest_src_10008.ds) AS user__ds_latest__extract_quarter + , EXTRACT(month FROM users_latest_src_10008.ds) AS user__ds_latest__extract_month + , EXTRACT(week FROM users_latest_src_10008.ds) AS user__ds_latest__extract_week + , EXTRACT(day FROM users_latest_src_10008.ds) AS user__ds_latest__extract_day + , EXTRACT(dow FROM users_latest_src_10008.ds) AS user__ds_latest__extract_dow + , EXTRACT(doy FROM users_latest_src_10008.ds) AS user__ds_latest__extract_doy , users_latest_src_10008.home_state_latest AS user__home_state_latest , users_latest_src_10008.user_id AS user FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/list/test_convert_table_semantic_model_with_measures__result0.txt b/metricflow/test/snapshots/test_convert_semantic_model.py/list/test_convert_table_semantic_model_with_measures__result0.txt new file mode 100644 index 0000000000..8a7e479c82 --- /dev/null +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/list/test_convert_table_semantic_model_with_measures__result0.txt @@ -0,0 +1,54 @@ +['ds__day', + 'ds__extract_day', + 'ds__extract_dow', + 'ds__extract_doy', + 'ds__extract_month', + 'ds__extract_quarter', + 'ds__extract_week', + 'ds__extract_year', + 'ds__month', + 'ds__quarter', + 'ds__week', + 'ds__year', + 'ds_partitioned__day', + 'ds_partitioned__extract_day', + 'ds_partitioned__extract_dow', + 'ds_partitioned__extract_doy', + 'ds_partitioned__extract_month', + 'ds_partitioned__extract_quarter', + 'ds_partitioned__extract_week', + 'ds_partitioned__extract_year', + 'ds_partitioned__month', + 'ds_partitioned__quarter', + 'ds_partitioned__week', + 'ds_partitioned__year', + 'identity_verifications', + 'user', + 'verification', + 'verification__ds__day', + 'verification__ds__extract_day', + 'verification__ds__extract_dow', + 'verification__ds__extract_doy', + 'verification__ds__extract_month', + 'verification__ds__extract_quarter', + 'verification__ds__extract_week', + 'verification__ds__extract_year', + 'verification__ds__month', + 'verification__ds__quarter', + 'verification__ds__week', + 'verification__ds__year', + 'verification__ds_partitioned__day', + 'verification__ds_partitioned__extract_day', + 'verification__ds_partitioned__extract_dow', + 'verification__ds_partitioned__extract_doy', + 'verification__ds_partitioned__extract_month', + 'verification__ds_partitioned__extract_quarter', + 'verification__ds_partitioned__extract_week', + 'verification__ds_partitioned__extract_year', + 'verification__ds_partitioned__month', + 'verification__ds_partitioned__quarter', + 'verification__ds_partitioned__week', + 'verification__ds_partitioned__year', + 'verification__user', + 'verification__verification_type', + 'verification_type'] diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/list/test_convert_table_semantic_model_without_measures__result0.txt b/metricflow/test/snapshots/test_convert_semantic_model.py/list/test_convert_table_semantic_model_without_measures__result0.txt new file mode 100644 index 0000000000..10a8d5d514 --- /dev/null +++ b/metricflow/test/snapshots/test_convert_semantic_model.py/list/test_convert_table_semantic_model_without_measures__result0.txt @@ -0,0 +1,27 @@ +['ds_latest__day', + 'ds_latest__extract_day', + 'ds_latest__extract_dow', + 'ds_latest__extract_doy', + 'ds_latest__extract_month', + 'ds_latest__extract_quarter', + 'ds_latest__extract_week', + 'ds_latest__extract_year', + 'ds_latest__month', + 'ds_latest__quarter', + 'ds_latest__week', + 'ds_latest__year', + 'home_state_latest', + 'user', + 'user__ds_latest__day', + 'user__ds_latest__extract_day', + 'user__ds_latest__extract_dow', + 'user__ds_latest__extract_doy', + 'user__ds_latest__extract_month', + 'user__ds_latest__extract_quarter', + 'user__ds_latest__extract_week', + 'user__ds_latest__extract_year', + 'user__ds_latest__month', + 'user__ds_latest__quarter', + 'user__ds_latest__week', + 'user__ds_latest__year', + 'user__home_state_latest'] diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql index 59e26e6b2d..d393bdc021 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql @@ -188,6 +188,18 @@ FROM ( , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day , subq_3.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy + , subq_3.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day + , subq_3.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week + , subq_3.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month + , subq_3.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter + , subq_3.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year + , subq_3.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year + , subq_3.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter + , subq_3.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month + , subq_3.bridge_account__ds_partitioned__extract_week AS bridge_account__ds_partitioned__extract_week + , subq_3.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day + , subq_3.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow + , subq_3.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month @@ -203,8 +215,11 @@ FROM ( , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id + , subq_3.bridge_account__account_id AS bridge_account__account_id + , subq_3.bridge_account__customer_id AS bridge_account__customer_id , subq_3.extra_dim AS extra_dim , subq_3.account_id__extra_dim AS account_id__extra_dim + , subq_3.bridge_account__extra_dim AS bridge_account__extra_dim , subq_5.customer_name AS customer_id__customer_name , subq_5.customer_atomic_weight AS customer_id__customer_atomic_weight FROM ( @@ -236,9 +251,24 @@ FROM ( , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day , EXTRACT(dayofweek FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow , EXTRACT(dayofyear FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_10011.extra_dim AS bridge_account__extra_dim + , bridge_table_src_10011.ds_partitioned AS bridge_account__ds_partitioned__day + , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, isoweek) AS bridge_account__ds_partitioned__week + , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, month) AS bridge_account__ds_partitioned__month + , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, quarter) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC(bridge_table_src_10011.ds_partitioned, year) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(isoweek FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_week + , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(dayofweek FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id + , bridge_table_src_10011.account_id AS bridge_account__account_id + , bridge_table_src_10011.customer_id AS bridge_account__customer_id FROM ***************************.bridge_table bridge_table_src_10011 ) subq_3 LEFT OUTER JOIN ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql index 0d1825bde4..c742d95f11 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql @@ -188,6 +188,18 @@ FROM ( , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day , subq_3.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy + , subq_3.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day + , subq_3.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week + , subq_3.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month + , subq_3.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter + , subq_3.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year + , subq_3.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year + , subq_3.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter + , subq_3.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month + , subq_3.bridge_account__ds_partitioned__extract_week AS bridge_account__ds_partitioned__extract_week + , subq_3.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day + , subq_3.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow + , subq_3.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month @@ -203,8 +215,11 @@ FROM ( , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id + , subq_3.bridge_account__account_id AS bridge_account__account_id + , subq_3.bridge_account__customer_id AS bridge_account__customer_id , subq_3.extra_dim AS extra_dim , subq_3.account_id__extra_dim AS account_id__extra_dim + , subq_3.bridge_account__extra_dim AS bridge_account__extra_dim , subq_5.customer_name AS customer_id__customer_name , subq_5.customer_atomic_weight AS customer_id__customer_atomic_weight FROM ( @@ -236,9 +251,24 @@ FROM ( , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day , EXTRACT(dow FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_10011.extra_dim AS bridge_account__extra_dim + , bridge_table_src_10011.ds_partitioned AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(week FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_week + , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(dow FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id + , bridge_table_src_10011.account_id AS bridge_account__account_id + , bridge_table_src_10011.customer_id AS bridge_account__customer_id FROM ***************************.bridge_table bridge_table_src_10011 ) subq_3 LEFT OUTER JOIN ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql index 0d1825bde4..c742d95f11 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql @@ -188,6 +188,18 @@ FROM ( , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day , subq_3.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy + , subq_3.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day + , subq_3.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week + , subq_3.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month + , subq_3.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter + , subq_3.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year + , subq_3.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year + , subq_3.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter + , subq_3.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month + , subq_3.bridge_account__ds_partitioned__extract_week AS bridge_account__ds_partitioned__extract_week + , subq_3.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day + , subq_3.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow + , subq_3.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month @@ -203,8 +215,11 @@ FROM ( , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id + , subq_3.bridge_account__account_id AS bridge_account__account_id + , subq_3.bridge_account__customer_id AS bridge_account__customer_id , subq_3.extra_dim AS extra_dim , subq_3.account_id__extra_dim AS account_id__extra_dim + , subq_3.bridge_account__extra_dim AS bridge_account__extra_dim , subq_5.customer_name AS customer_id__customer_name , subq_5.customer_atomic_weight AS customer_id__customer_atomic_weight FROM ( @@ -236,9 +251,24 @@ FROM ( , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day , EXTRACT(dow FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_10011.extra_dim AS bridge_account__extra_dim + , bridge_table_src_10011.ds_partitioned AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(week FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_week + , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(dow FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id + , bridge_table_src_10011.account_id AS bridge_account__account_id + , bridge_table_src_10011.customer_id AS bridge_account__customer_id FROM ***************************.bridge_table bridge_table_src_10011 ) subq_3 LEFT OUTER JOIN ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql index 0d1825bde4..c742d95f11 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql @@ -188,6 +188,18 @@ FROM ( , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day , subq_3.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy + , subq_3.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day + , subq_3.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week + , subq_3.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month + , subq_3.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter + , subq_3.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year + , subq_3.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year + , subq_3.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter + , subq_3.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month + , subq_3.bridge_account__ds_partitioned__extract_week AS bridge_account__ds_partitioned__extract_week + , subq_3.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day + , subq_3.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow + , subq_3.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month @@ -203,8 +215,11 @@ FROM ( , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id + , subq_3.bridge_account__account_id AS bridge_account__account_id + , subq_3.bridge_account__customer_id AS bridge_account__customer_id , subq_3.extra_dim AS extra_dim , subq_3.account_id__extra_dim AS account_id__extra_dim + , subq_3.bridge_account__extra_dim AS bridge_account__extra_dim , subq_5.customer_name AS customer_id__customer_name , subq_5.customer_atomic_weight AS customer_id__customer_atomic_weight FROM ( @@ -236,9 +251,24 @@ FROM ( , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day , EXTRACT(dow FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_10011.extra_dim AS bridge_account__extra_dim + , bridge_table_src_10011.ds_partitioned AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(week FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_week + , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(dow FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id + , bridge_table_src_10011.account_id AS bridge_account__account_id + , bridge_table_src_10011.customer_id AS bridge_account__customer_id FROM ***************************.bridge_table bridge_table_src_10011 ) subq_3 LEFT OUTER JOIN ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql index 0d1825bde4..c742d95f11 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql @@ -188,6 +188,18 @@ FROM ( , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day , subq_3.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy + , subq_3.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day + , subq_3.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week + , subq_3.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month + , subq_3.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter + , subq_3.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year + , subq_3.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year + , subq_3.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter + , subq_3.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month + , subq_3.bridge_account__ds_partitioned__extract_week AS bridge_account__ds_partitioned__extract_week + , subq_3.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day + , subq_3.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow + , subq_3.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month @@ -203,8 +215,11 @@ FROM ( , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id + , subq_3.bridge_account__account_id AS bridge_account__account_id + , subq_3.bridge_account__customer_id AS bridge_account__customer_id , subq_3.extra_dim AS extra_dim , subq_3.account_id__extra_dim AS account_id__extra_dim + , subq_3.bridge_account__extra_dim AS bridge_account__extra_dim , subq_5.customer_name AS customer_id__customer_name , subq_5.customer_atomic_weight AS customer_id__customer_atomic_weight FROM ( @@ -236,9 +251,24 @@ FROM ( , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day , EXTRACT(dow FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_10011.extra_dim AS bridge_account__extra_dim + , bridge_table_src_10011.ds_partitioned AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(week FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_week + , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(dow FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id + , bridge_table_src_10011.account_id AS bridge_account__account_id + , bridge_table_src_10011.customer_id AS bridge_account__customer_id FROM ***************************.bridge_table bridge_table_src_10011 ) subq_3 LEFT OUTER JOIN ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql index 0d1825bde4..c742d95f11 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql @@ -188,6 +188,18 @@ FROM ( , subq_3.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day , subq_3.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow , subq_3.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy + , subq_3.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day + , subq_3.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week + , subq_3.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month + , subq_3.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter + , subq_3.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year + , subq_3.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year + , subq_3.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter + , subq_3.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month + , subq_3.bridge_account__ds_partitioned__extract_week AS bridge_account__ds_partitioned__extract_week + , subq_3.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day + , subq_3.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow + , subq_3.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy , subq_5.ds_partitioned__day AS customer_id__ds_partitioned__day , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month @@ -203,8 +215,11 @@ FROM ( , subq_3.account_id AS account_id , subq_3.customer_id AS customer_id , subq_3.account_id__customer_id AS account_id__customer_id + , subq_3.bridge_account__account_id AS bridge_account__account_id + , subq_3.bridge_account__customer_id AS bridge_account__customer_id , subq_3.extra_dim AS extra_dim , subq_3.account_id__extra_dim AS account_id__extra_dim + , subq_3.bridge_account__extra_dim AS bridge_account__extra_dim , subq_5.customer_name AS customer_id__customer_name , subq_5.customer_atomic_weight AS customer_id__customer_atomic_weight FROM ( @@ -236,9 +251,24 @@ FROM ( , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_day , EXTRACT(dow FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_dow , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__extract_doy + , bridge_table_src_10011.extra_dim AS bridge_account__extra_dim + , bridge_table_src_10011.ds_partitioned AS bridge_account__ds_partitioned__day + , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__year + , EXTRACT(year FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_year + , EXTRACT(quarter FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter + , EXTRACT(month FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_month + , EXTRACT(week FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_week + , EXTRACT(day FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_day + , EXTRACT(dow FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow + , EXTRACT(doy FROM bridge_table_src_10011.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy , bridge_table_src_10011.account_id , bridge_table_src_10011.customer_id , bridge_table_src_10011.customer_id AS account_id__customer_id + , bridge_table_src_10011.account_id AS bridge_account__account_id + , bridge_table_src_10011.customer_id AS bridge_account__customer_id FROM ***************************.bridge_table bridge_table_src_10011 ) subq_3 LEFT OUTER JOIN ( diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_scd_dimension__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_scd_dimension__plan0.xml index 79159f5015..6072f1480d 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_scd_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_join_to_scd_dimension__plan0.xml @@ -549,347 +549,347 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -929,231 +929,231 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml index ff39aa7c9b..8bdf2ed4b4 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_through_scd_dimension__plan0.xml @@ -528,347 +528,347 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1199,231 +1199,231 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1579,111 +1579,111 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml index ce6f655f22..54f4173efc 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_hop_to_scd_dimension__plan0.xml @@ -528,347 +528,347 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1034,15 +1034,15 @@ - + - + - + @@ -1319,207 +1319,207 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml index 188f6f7b0d..371989c2c7 100644 --- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multihop_node__plan0.xml @@ -4,11 +4,11 @@ - + - + @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,11 +36,11 @@ - + - + @@ -49,23 +49,23 @@ - + - + - + - + - + @@ -82,15 +82,15 @@ - + - + - + @@ -99,259 +99,259 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -583,15 +583,15 @@ - + - + - + @@ -600,175 +600,235 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + - + - + - + - + - + + + + + - + - + @@ -888,15 +948,75 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -940,119 +1060,119 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1061,119 +1181,119 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/metricflow/test/snapshots/test_linkable_spec_resolver.py/str/test_all_properties__result0.txt b/metricflow/test/snapshots/test_linkable_spec_resolver.py/str/test_all_properties__result0.txt index c8353a502b..26b6031523 100644 --- a/metricflow/test/snapshots/test_linkable_spec_resolver.py/str/test_all_properties__result0.txt +++ b/metricflow/test/snapshots/test_linkable_spec_resolver.py/str/test_all_properties__result0.txt @@ -28,12 +28,22 @@ users_ds_source ('listing', 'user') created_at MONTH users_ds_source ('listing', 'user') created_at QUARTER ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') created_at WEEK ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') created_at YEAR ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] +users_ds_source ('listing', 'user') ds DAY ['JOINED', 'MULTI_HOP'] +users_ds_source ('listing', 'user') ds MONTH ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] +users_ds_source ('listing', 'user') ds QUARTER ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] +users_ds_source ('listing', 'user') ds WEEK ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] +users_ds_source ('listing', 'user') ds YEAR ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') ds_partitioned DAY ['JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') ds_partitioned MONTH ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') ds_partitioned QUARTER ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') ds_partitioned WEEK ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') ds_partitioned YEAR ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') home_state ['JOINED', 'MULTI_HOP'] +users_latest ('listing', 'user') ds_latest DAY ['JOINED', 'MULTI_HOP'] +users_latest ('listing', 'user') ds_latest MONTH ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] +users_latest ('listing', 'user') ds_latest QUARTER ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] +users_latest ('listing', 'user') ds_latest WEEK ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] +users_latest ('listing', 'user') ds_latest YEAR ['DERIVED_TIME_GRANULARITY', 'JOINED', 'MULTI_HOP'] users_latest ('listing', 'user') home_state_latest ['JOINED', 'MULTI_HOP'] views_source () listing ['ENTITY', 'LOCAL'] views_source () metric_time DAY ['METRIC_TIME'] diff --git a/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt b/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt index 3abcc19d22..cf0414792a 100644 --- a/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt +++ b/metricflow/test/snapshots/test_node_data_set.py/list/test_joined_node_data_set__result0.txt @@ -25,16 +25,16 @@ 'ds__year', 'txn_revenue', 'user', - 'user__ds__day', - 'user__ds__extract_day', - 'user__ds__extract_dow', - 'user__ds__extract_doy', - 'user__ds__extract_month', - 'user__ds__extract_quarter', - 'user__ds__extract_week', - 'user__ds__extract_year', - 'user__ds__month', - 'user__ds__quarter', - 'user__ds__week', - 'user__ds__year', + 'user__ds_latest__day', + 'user__ds_latest__extract_day', + 'user__ds_latest__extract_dow', + 'user__ds_latest__extract_doy', + 'user__ds_latest__extract_month', + 'user__ds_latest__extract_quarter', + 'user__ds_latest__extract_week', + 'user__ds_latest__extract_year', + 'user__ds_latest__month', + 'user__ds_latest__quarter', + 'user__ds_latest__week', + 'user__ds_latest__year', 'user__home_state_latest'] diff --git a/metricflow/test/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt b/metricflow/test/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt index f50761e42d..306ae39392 100644 --- a/metricflow/test/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt +++ b/metricflow/test/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt @@ -4,6 +4,7 @@ 'country_latest', 'created_at', 'ds', + 'ds_latest', 'ds_partitioned', 'home_state', 'home_state_latest', diff --git a/metricflow/test/snapshots/test_semantic_model_container.py/str/test_linkable_set__result0.txt b/metricflow/test/snapshots/test_semantic_model_container.py/str/test_linkable_set__result0.txt index b7d9cf0827..09c1c191ca 100644 --- a/metricflow/test/snapshots/test_semantic_model_container.py/str/test_linkable_set__result0.txt +++ b/metricflow/test/snapshots/test_semantic_model_container.py/str/test_linkable_set__result0.txt @@ -12,12 +12,16 @@ listings_latest ('listing',) is_lux_latest listings_latest ('listing',) user ['ENTITY', 'JOINED'] lux_listing_mapping ('listing',) lux_listing ['ENTITY', 'JOINED'] users_ds_source ('listing', 'user') created_at DAY ['JOINED', 'MULTI_HOP'] +users_ds_source ('listing', 'user') ds DAY ['JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') ds_partitioned DAY ['JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') home_state ['JOINED', 'MULTI_HOP'] users_ds_source ('user',) created_at DAY ['JOINED'] +users_ds_source ('user',) ds DAY ['JOINED'] users_ds_source ('user',) ds_partitioned DAY ['JOINED'] users_ds_source ('user',) home_state ['JOINED'] +users_latest ('listing', 'user') ds_latest DAY ['JOINED', 'MULTI_HOP'] users_latest ('listing', 'user') home_state_latest ['JOINED', 'MULTI_HOP'] +users_latest ('user',) ds_latest DAY ['JOINED'] users_latest ('user',) home_state_latest ['JOINED'] views_source () listing ['ENTITY', 'LOCAL'] views_source () user ['ENTITY', 'LOCAL'] diff --git a/metricflow/test/snapshots/test_semantic_model_container.py/str/test_linkable_set_for_common_dimensions_in_different_models__result0.txt b/metricflow/test/snapshots/test_semantic_model_container.py/str/test_linkable_set_for_common_dimensions_in_different_models__result0.txt index b56a470a75..2ff65f8c34 100644 --- a/metricflow/test/snapshots/test_semantic_model_container.py/str/test_linkable_set_for_common_dimensions_in_different_models__result0.txt +++ b/metricflow/test/snapshots/test_semantic_model_container.py/str/test_linkable_set_for_common_dimensions_in_different_models__result0.txt @@ -12,8 +12,10 @@ listings_latest ('listing',) is_lux_latest listings_latest ('listing',) user ['ENTITY', 'JOINED'] lux_listing_mapping ('listing',) lux_listing ['ENTITY', 'JOINED'] users_ds_source ('listing', 'user') created_at DAY ['JOINED', 'MULTI_HOP'] +users_ds_source ('listing', 'user') ds DAY ['JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') ds_partitioned DAY ['JOINED', 'MULTI_HOP'] users_ds_source ('listing', 'user') home_state ['JOINED', 'MULTI_HOP'] +users_latest ('listing', 'user') ds_latest DAY ['JOINED', 'MULTI_HOP'] users_latest ('listing', 'user') home_state_latest ['JOINED', 'MULTI_HOP'] views_source () listing ['ENTITY', 'LOCAL'] views_source () metric_time DAY ['METRIC_TIME'] diff --git a/metricflow/test/snapshots/test_semantic_model_container.py/tuple/test_elements_for_metric__result0.txt b/metricflow/test/snapshots/test_semantic_model_container.py/tuple/test_elements_for_metric__result0.txt index 5891bc57cb..1a6e510df2 100644 --- a/metricflow/test/snapshots/test_semantic_model_container.py/tuple/test_elements_for_metric__result0.txt +++ b/metricflow/test/snapshots/test_semantic_model_container.py/tuple/test_elements_for_metric__result0.txt @@ -9,6 +9,8 @@ 'listing__user__company', 'listing__user__company_name', 'listing__user__created_at__day', + 'listing__user__ds__day', + 'listing__user__ds_latest__day', 'listing__user__ds_partitioned__day', 'listing__user__home_state', 'listing__user__home_state_latest', @@ -16,6 +18,8 @@ 'user__company', 'user__company_name', 'user__created_at__day', + 'user__ds__day', + 'user__ds_latest__day', 'user__ds_partitioned__day', 'user__home_state', 'user__home_state_latest',