Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cast all relation names to lowercase while evaluating dependencies #130

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dbt_meshify/dbt_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion dbt_meshify/storage/dbt_project_editors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions dbt_meshify/utilities/linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand All @@ -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
},
Expand Down Expand Up @@ -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
},
Expand Down
1 change: 1 addition & 0 deletions test-projects/source-hack/src_proj_b/models/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ sources:
schema: main
tables:
- name: shared_model
identifier: SHARED_MODEL