From d5b6c82c317ae791b3b172a340404bf94d02833d Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Fri, 18 Aug 2023 16:45:38 -0500 Subject: [PATCH] cast all relation names to lowercase --- dbt_meshify/dbt_projects.py | 4 ++-- dbt_meshify/storage/dbt_project_editors.py | 1 - dbt_meshify/utilities/linker.py | 12 ++++++------ .../source-hack/src_proj_b/models/_sources.yml | 1 + 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dbt_meshify/dbt_projects.py b/dbt_meshify/dbt_projects.py index d5e7ef0..9ece30f 100644 --- a/dbt_meshify/dbt_projects.py +++ b/dbt_meshify/dbt_projects.py @@ -49,12 +49,12 @@ def __init__( self.resources = resources if resources else set() self.model_relation_names: Dict[str, str] = { - model.relation_name: unique_id + model.relation_name.lower(): unique_id for unique_id, model in self.models.items() if model.relation_name is not None } self.source_relation_names: Dict[str, str] = { - source.relation_name: unique_id + source.relation_name.lower(): unique_id for unique_id, source in self.sources().items() if source.relation_name is not None } diff --git a/dbt_meshify/storage/dbt_project_editors.py b/dbt_meshify/storage/dbt_project_editors.py index a872369..11965ec 100644 --- a/dbt_meshify/storage/dbt_project_editors.py +++ b/dbt_meshify/storage/dbt_project_editors.py @@ -167,7 +167,6 @@ def initialize(self) -> ChangeSet: change_set.add(self.move_resource(resource)) change_set.extend(self.move_resource_yml_entry(resource)) - if isinstance(resource, (ModelNode, GenericTestNode, SnapshotNode)) and any( node for node in resource.depends_on.nodes diff --git a/dbt_meshify/utilities/linker.py b/dbt_meshify/utilities/linker.py index aee1a84..775aea9 100644 --- a/dbt_meshify/utilities/linker.py +++ b/dbt_meshify/utilities/linker.py @@ -73,12 +73,12 @@ def _source_dependencies( relations = self._find_relation_dependencies( source_relations={ - model.relation_name + model.relation_name.lower() for model in project.models.values() if model.relation_name is not None }, target_relations={ - source.relation_name + source.relation_name.lower() for source in other_project.sources().values() if source.relation_name is not None }, @@ -97,12 +97,12 @@ def _source_dependencies( backwards_relations = self._find_relation_dependencies( source_relations={ - model.relation_name + model.relation_name.lower() for model in other_project.models.values() if model.relation_name is not None }, target_relations={ - source.relation_name + source.relation_name.lower() for source in project.sources().values() if source.relation_name is not None }, @@ -142,12 +142,12 @@ def _package_dependencies( # find which models are in both manifests relations = self._find_relation_dependencies( source_relations={ - model.relation_name + model.relation_name.lower() for model in project.models.values() if model.relation_name is not None }, target_relations={ - model.relation_name + model.relation_name.lower() for model in other_project.models.values() if model.relation_name is not None }, diff --git a/test-projects/source-hack/src_proj_b/models/_sources.yml b/test-projects/source-hack/src_proj_b/models/_sources.yml index 0917ead..85d14f1 100644 --- a/test-projects/source-hack/src_proj_b/models/_sources.yml +++ b/test-projects/source-hack/src_proj_b/models/_sources.yml @@ -5,3 +5,4 @@ sources: schema: main tables: - name: shared_model + identifier: SHARED_MODEL