From 0e4cbf03daafd1b251f671e22b0ecebc80185074 Mon Sep 17 00:00:00 2001 From: NEC-Vishal Date: Mon, 21 Nov 2022 04:10:04 +0000 Subject: [PATCH 1/3] resolved error handling in sql_translator --- src/translators/sql_translator.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/translators/sql_translator.py b/src/translators/sql_translator.py index fe66fc03..fbbdd157 100644 --- a/src/translators/sql_translator.py +++ b/src/translators/sql_translator.py @@ -362,15 +362,13 @@ def _insert_entity_rows(self, table_name: str, col_names: List[str], stmt = f"insert into {table_name} ({col_list}) values ({placeholders})" try: start_time = datetime.now() + res_list = [] for batch in to_insert_batches(rows): res = self.cursor.executemany(stmt, batch) - # new version of crate does not bomb anymore when - # something goes wrong in multi entries - # simply it returns -2 for each row that have an issue - # TODO: improve error handling. - # using batches, we don't need to fail the whole set - # but only failing batches. + res_list.append(res) + + for res in res_list: if isinstance(res, list): for i in range(len(res)): if res[i]['rowcount'] < 0: From 1bb27be3ee2c8bd5061bd26c14a289645bbdc229 Mon Sep 17 00:00:00 2001 From: NEC-Vishal <105697861+NEC-Vishal@users.noreply.github.com> Date: Mon, 21 Nov 2022 09:46:06 +0530 Subject: [PATCH 2/3] Update RELEASE_NOTES.md --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index b41d37df..c0de985b 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -24,6 +24,7 @@ - Replaced entity with getter (#652) - Resolved TODO in Dockerfile (#680) - Resolved TODO at src/reporter/tests/test_timescale_types.py (#667) +- Resolved TODO at src/translator/sql_translator.py (#697) ### Bug fixes From 6ead12f42338c35764835655e43b89bf072bb452 Mon Sep 17 00:00:00 2001 From: NEC-Vishal <105697861+NEC-Vishal@users.noreply.github.com> Date: Mon, 21 Nov 2022 09:52:51 +0530 Subject: [PATCH 3/3] Update sql_translator.py --- src/translators/sql_translator.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/translators/sql_translator.py b/src/translators/sql_translator.py index fbbdd157..18df28fa 100644 --- a/src/translators/sql_translator.py +++ b/src/translators/sql_translator.py @@ -367,7 +367,6 @@ def _insert_entity_rows(self, table_name: str, col_names: List[str], for batch in to_insert_batches(rows): res = self.cursor.executemany(stmt, batch) res_list.append(res) - for res in res_list: if isinstance(res, list): for i in range(len(res)):