Skip to content

Commit

Permalink
[dbt-labs#3711] Check that test unique_id exists in nodes when removing
Browse files Browse the repository at this point in the history
  • Loading branch information
gshank authored and TeddyCr committed Sep 9, 2021
1 parent 5880640 commit e16d001
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Contributors:

### Under the hood
- Switch to full reparse on partial parsing exceptions. Log and report exception information. ([#3725](https://github.com/dbt-labs/dbt/issues/3725), [#3733](https://github.com/dbt-labs/dbt/pull/3733))
- Check for existence of test node when removing. ([#3711](https://github.com/dbt-labs/dbt/issues/3711), [#3750](https://github.com/dbt-labs/dbt/pull/3750))


## dbt 0.20.1 (August 11, 2021)
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/parser/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def load(self):
"Switching to a full re-parse.")

# Get traceback info
tb_info = traceback.format_exc(10)
tb_info = traceback.format_exc()
formatted_lines = tb_info.splitlines()
(_, line, method) = formatted_lines[-3].split(', ')
exc_info = {
Expand Down
5 changes: 3 additions & 2 deletions core/dbt/parser/partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,9 @@ def delete_schema_mssa_links(self, schema_file, dict_key, elem):
def remove_tests(self, schema_file, dict_key, name):
tests = schema_file.get_tests(dict_key, name)
for test_unique_id in tests:
node = self.saved_manifest.nodes.pop(test_unique_id)
self.deleted_manifest.nodes[test_unique_id] = node
if test_unique_id in self.saved_manifest.nodes:
node = self.saved_manifest.nodes.pop(test_unique_id)
self.deleted_manifest.nodes[test_unique_id] = node
schema_file.remove_tests(dict_key, name)

def delete_schema_source(self, schema_file, source_dict):
Expand Down

0 comments on commit e16d001

Please sign in to comment.