compare function changed to identify new cols
This commit is contained in:
parent
37f7edabaf
commit
a337abb94b
4
main.py
4
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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user