-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Description * Add directory anchors for all semantics manifests. * Update test fixtures to load manifests using paths from anchors. * Move `example_project_configuration.py` to `test_helpers`. * Remove unused `SQLAlchemy`-related classes. <!--- Before requesting review, please make sure you have: 1. read [the contributing guide](https://github.com/dbt-labs/metricflow/blob/main/CONTRIBUTING.md), 2. signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements) 3. run `changie new` to [create a changelog entry](https://github.com/dbt-labs/metricflow/blob/main/CONTRIBUTING.md#adding-a-changelog-entry) -->
- Loading branch information
Showing
20 changed files
with
158 additions
and
334 deletions.
There are no files selected for viewing
File renamed without changes.
26 changes: 9 additions & 17 deletions
26
metricflow-semantics/metricflow_semantics/test_helpers/manifest_helpers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,26 @@ | ||
from __future__ import annotations | ||
|
||
import pathlib | ||
from typing import Dict, Optional | ||
|
||
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, | ||
) | ||
from dbt_semantic_interfaces.validations.semantic_manifest_validator import SemanticManifestValidator | ||
|
||
from metricflow_semantics.test_helpers.semantic_manifest_yamls import SEMANTIC_MANIFEST_YAMLS_PATH_ANCHOR | ||
|
||
|
||
def load_semantic_manifest( | ||
relative_manifest_path: str, | ||
yaml_file_directory: pathlib.Path, | ||
template_mapping: Optional[Dict[str, str]] = None, | ||
) -> SemanticManifestBuildResult: | ||
) -> PydanticSemanticManifest: | ||
"""Reads the manifest YAMLs from the standard location, applies transformations, runs validations.""" | ||
yaml_file_directory = SEMANTIC_MANIFEST_YAMLS_PATH_ANCHOR.directory.joinpath(relative_manifest_path) | ||
build_result = parse_directory_of_yaml_files_to_semantic_manifest( | ||
str(yaml_file_directory), template_mapping=template_mapping | ||
) | ||
validator = SemanticManifestValidator[PydanticSemanticManifest]() | ||
validator.checked_validations(build_result.semantic_manifest) | ||
return build_result | ||
|
||
|
||
def load_named_manifest(template_mapping: Dict[str, str], manifest_name: str) -> PydanticSemanticManifest: # noqa: D103 | ||
try: | ||
build_result = load_semantic_manifest(manifest_name, template_mapping) | ||
build_result = parse_directory_of_yaml_files_to_semantic_manifest( | ||
str(yaml_file_directory), template_mapping=template_mapping | ||
) | ||
validator = SemanticManifestValidator[PydanticSemanticManifest]() | ||
validator.checked_validations(build_result.semantic_manifest) | ||
return build_result.semantic_manifest | ||
except Exception as e: | ||
raise RuntimeError(f"Error while loading semantic manifest: {manifest_name}") from e | ||
raise RuntimeError(f"Error while loading semantic manifest: {yaml_file_directory}") from e |
5 changes: 5 additions & 0 deletions
5
..._semantics/test_helpers/semantic_manifest_yamls/ambiguous_resolution_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
AMBIGUOUS_RESOLUTION_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...ricflow_semantics/test_helpers/semantic_manifest_yamls/config_linter_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
CONFIG_LINTER_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...etricflow_semantics/test_helpers/semantic_manifest_yamls/cyclic_join_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
CYCLIC_JOIN_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...ntics/test_helpers/semantic_manifest_yamls/data_warehouse_validation_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
DW_VALIDATION_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...ricflow_semantics/test_helpers/semantic_manifest_yamls/extended_date_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
EXTENDED_DATE_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...metricflow_semantics/test_helpers/semantic_manifest_yamls/join_types_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
JOIN_TYPES_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...icflow_semantics/test_helpers/semantic_manifest_yamls/multi_hop_join_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
MULTI_HOP_JOIN_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...ics/metricflow_semantics/test_helpers/semantic_manifest_yamls/non_sm_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
NON_SM_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...tics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
PARTITIONED_MULTI_HOP_JOIN_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...antics/metricflow_semantics/test_helpers/semantic_manifest_yamls/scd_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
SCD_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...ics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
SIMPLE_MANIFEST_ANCHOR = DirectoryPathAnchor() |
5 changes: 5 additions & 0 deletions
5
...semantics/test_helpers/semantic_manifest_yamls/simple_multi_hop_join_manifest/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
from metricflow_semantics.test_helpers.config_helpers import DirectoryPathAnchor | ||
|
||
SIMPLE_MULTI_HOP_JOIN_MANIFEST_ANCHOR = DirectoryPathAnchor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.