From 94b65933561f2212f49c1323055c07c5da8f18b4 Mon Sep 17 00:00:00 2001 From: Purna Shah <120611704+purna2U@users.noreply.github.com> Date: Wed, 28 Jun 2023 17:56:43 -0700 Subject: [PATCH] chore: fix linter --- dbt_schema_builder/relation.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/dbt_schema_builder/relation.py b/dbt_schema_builder/relation.py index c297c30..e7d494d 100644 --- a/dbt_schema_builder/relation.py +++ b/dbt_schema_builder/relation.py @@ -97,26 +97,26 @@ def find_in_current_sources( for source in current_downstream_sources["sources"]: if source["name"] == self.app: for table in source["tables"]: - if table and table["name"] == self.source_relation_name: - if prefix: - # Handle prefix when no prefix has been applied already from prior runs - table["name"] = prefix + '_' + table["name"] + if table and prefix and table["name"] == self.source_relation_name: + # Handle prefix when no prefix has been applied already from prior runs + table["name"] = prefix + '_' + table["name"] + elif table and table["name"] == self.source_relation_name: + # No prefix already applied, no prefix to be applied current_safe_downstream_source = table - elif prefix: + elif prefix and table and table["name"] == prefix + '_' + self.source_relation_name: # Handle prefix when already applied from prior runs - if table and table["name"] == prefix + '_' + self.source_relation_name: - current_safe_downstream_source = table + current_safe_downstream_source = table elif source["name"] == "{}_PII".format(self.app): for table in source["tables"]: - if table and table["name"] == self.source_relation_name: - if prefix: - # Handle prefix for PII schema when no prefix has been applied already from prior runs - table["name"] = prefix + '_' + table["name"] + if table and prefix and table["name"] == self.source_relation_name: + # Handle prefix for PII schema when no prefix has been applied already from prior runs + table["name"] = prefix + '_' + table["name"] + elif table and table["name"] == self.source_relation_name: + # No prefix already applied, no prefix to be applied for PII schema current_pii_downstream_source = table - elif prefix: + elif prefix and table and table["name"] == prefix + '_' + self.source_relation_name: # Handle prefix for PII schema when already applied from prior runs - if table and table["name"] == prefix + '_' + self.source_relation_name: - current_pii_downstream_source = table + current_pii_downstream_source = table if current_safe_downstream_source and current_pii_downstream_source: break