diff --git a/core/dbt/parser/partial.py b/core/dbt/parser/partial.py index edcae83574a..b99d876f8ae 100644 --- a/core/dbt/parser/partial.py +++ b/core/dbt/parser/partial.py @@ -895,6 +895,14 @@ def delete_schema_semantic_model(self, schema_file, semantic_model_dict): elif unique_id in self.saved_manifest.disabled: self.delete_disabled(unique_id, schema_file.file_id) + metrics = schema_file.metrics.copy() + for unique_id in metrics: + if unique_id in self.saved_manifest.metrics: + self.saved_manifest.metrics.pop(unique_id) + schema_file.metrics.remove(unique_id) + elif unique_id in self.saved_manifest.disabled: + self.delete_disabled(unique_id, schema_file.file_id) + def get_schema_element(self, elem_list, elem_name): for element in elem_list: if "name" in element and element["name"] == elem_name: