Skip to content

Commit

Permalink
Correction for 1e4112c
Browse files Browse the repository at this point in the history
The last fix was wrong, because the test if the table is empty has to be before the len() execution.
  • Loading branch information
dkratzert committed Jul 13, 2023
1 parent 1e4112c commit 6ced690
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/structurefinder/searcher/database_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ def merge_databases(self, db2: str) -> None:

def merge_table(self, table_name: str) -> None:
# noinspection SqlResolve
table_size = len(self.con.execute(f"SELECT * from dba.{table_name}").fetchone())
if not table_size:
fetchone = self.con.execute(f"SELECT * from dba.{table_name}").fetchone()
if not fetchone:
print(f"Table is empty, skipping table '{table_name}'")
return
table_size = len(fetchone)
placeholders = ', '.join('?' * table_size)
last_row_id = self.db_fetchone(f"""SELECT max(id) FROM {table_name}""")[0]
next_id = last_row_id + 1
Expand Down

0 comments on commit 6ced690

Please sign in to comment.