From 356dc06c733e33d0b8b6e30c13f2fcccace15a5c Mon Sep 17 00:00:00 2001 From: Virginia Lopez-Gil Date: Sun, 2 May 2021 17:01:09 +0200 Subject: [PATCH] fix: order of the combine list Make nicer the logs --- dbt_sugar/core/task/base.py | 2 +- dbt_sugar/core/task/doc.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dbt_sugar/core/task/base.py b/dbt_sugar/core/task/base.py index 352cfaab..77dc4323 100644 --- a/dbt_sugar/core/task/base.py +++ b/dbt_sugar/core/task/base.py @@ -192,7 +192,7 @@ def update_model_description_test_tags( tests = dict_column_description_to_update[column_name].get("tests") if tests: column["tests"] = self.combine_two_list_without_duplicates( - column.get("tests", []), tests + tests, column.get("tests", []) ) # Update the tags without duplicating them. diff --git a/dbt_sugar/core/task/doc.py b/dbt_sugar/core/task/doc.py index ec0c3663..0123a69d 100644 --- a/dbt_sugar/core/task/doc.py +++ b/dbt_sugar/core/task/doc.py @@ -117,7 +117,8 @@ def move_name_and_description_to_first_position(self, model: Dict[str, Any]): """ # DEPRECATION: Drop ordered dict when dropping python 3.6 support ordered_dict = OrderedDict(model) - ordered_dict.move_to_end("description", last=False) + if ordered_dict.get("description"): + ordered_dict.move_to_end("description", last=False) ordered_dict.move_to_end("name", last=False) return ordered_dict @@ -311,9 +312,9 @@ def check_tests(self, path_file: Path, model_name: str) -> None: if "Compilation Error" in dbt_result_command: logger.info( - "There's have been a compilation error in one or more custom tests that you have added.\n" - "Not able to check if the tests that you have added has PASS.\n" - f"The dbt original logs: {dbt_result_command}" + "dbt encountered a compilation error in one or more of your custom tests.\n" + "Not able to check if the tests that you have added have PASSED.\n" + f"This is what dbt's compilation error says:\n{dbt_result_command}" ) for column in self.column_update_payload.keys():