From a337abb94b190b8cff36fb3d597429e65e10ab51 Mon Sep 17 00:00:00 2001 From: "gowthaman.b" Date: Mon, 19 Jun 2023 22:24:49 +0530 Subject: [PATCH] compare function changed to identify new cols --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index e61a7fd..fcc5b09 100644 --- a/main.py +++ b/main.py @@ -68,7 +68,7 @@ class DBConn: # there might be a scenario that new cols might appear at a later stage, if so, # we shall accommodate by adding it to the database tbl_cols = self.table_mapping[tbl] - if len(tbl_cols) < len(col_names): + if tbl_cols != col_names: not_found = [] for col in col_names: if col not in tbl_cols: @@ -79,7 +79,7 @@ class DBConn: self.cur.execute(f"alter table \"{tbl}\" add column \"{new_col}\" text") print(f"added new cols {', '.join(not_found)} to {tbl}") - self.table_mapping[tbl] = column_data + self.table_mapping[tbl] = col_names sql = f"insert into \"{tbl}\" ({col_names_placeholder}) values({value_placeholders})" if args.debug: