Skip to content

Commit

Permalink
Fix signature and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank committed Sep 25, 2024
1 parent 6314d8a commit 50c0a27
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/dbt/parser/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,9 @@ def process_model_inferred_primary_keys(self):
continue
if not model_to_generic_test_map:
model_to_generic_test_map = self.build_model_to_generic_tests_map()
generic_tests = model_to_generic_test_map[node.unique_id]
generic_tests: List[GenericTestNode] = []
if node.unique_id in model_to_generic_test_map:
generic_tests = model_to_generic_test_map[node.unique_id]
primary_key = node.infer_primary_key(generic_tests)
node.primary_key = sorted(primary_key)

Expand Down Expand Up @@ -1430,10 +1432,7 @@ def write_perf_info(self, target_path: str):
write_file(path, json.dumps(self._perf_info, cls=dbt.utils.JSONEncoder, indent=4))
fire_event(ParsePerfInfoPath(path=path))

def build_model_to_generic_tests_map(
self,
model: ModelNode,
) -> Dict[str, List[GenericTestNode]]:
def build_model_to_generic_tests_map(self) -> Dict[str, List[GenericTestNode]]:
"""Return a list of generic tests that are attached to the given model, including disabled tests"""
model_to_generic_tests_map: Dict[str, List[GenericTestNode]] = {}
for _, node in self.manifest.nodes.items():
Expand Down

0 comments on commit 50c0a27

Please sign in to comment.