compare function changed to identify new cols

This commit is contained in:
gowthaman.b 2023-06-19 22:24:49 +05:30
parent 37f7edabaf
commit a337abb94b

View File

@ -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: