Skip to content

Commit

Permalink
added check on table presence on update
Browse files Browse the repository at this point in the history
  • Loading branch information
nsimakov committed Jul 12, 2020
1 parent 3dc1162 commit b2dce6b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions akrr/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,18 @@ def _update_db_populate_new_db(self):
ak_con, ak_cur = self.get_old_ak_db_con()
tables_to_load = self.tables_to_drop['mod_appkernel']['tables']
tables_to_load.reverse()

cursor_execute(ak_cur, "show tables")
ak_tables = tuple((r[0] for r in akrr_cur.fetchall()))

for table_name in tables_to_load:
table_pkl_name = self._get_table_pkl_name("mod_appkernel", table_name)
if not os.path.isfile(table_pkl_name):
log.debug("Table %s was not saved (might not present in previous version)", table_name)
continue
if table_name not in ak_tables:
log.debug("Table %s is not in current mod_appkernel", table_name)
continue
log.debug("Populating: mod_appkernel.%s" % table_name)

cursor_execute(ak_cur, "show columns from %s" % table_name)
Expand Down

0 comments on commit b2dce6b

Please sign in to comment.