From 399a53b895509c4e8eb56af551eda4ac4340b68f Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Fri, 6 Aug 2021 07:42:50 -0600 Subject: [PATCH] lf_dash.py : try except added around appending to db with different columns 1. the databases need to match with the column layout for kpi, the db may get corrupted, either enter a new db or regenerate old one. Signed-off-by: Chuck SmileyRekiere --- py-scripts/tools/lf_dash.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/py-scripts/tools/lf_dash.py b/py-scripts/tools/lf_dash.py index 901541c9..e53b0690 100755 --- a/py-scripts/tools/lf_dash.py +++ b/py-scripts/tools/lf_dash.py @@ -65,7 +65,11 @@ class csv_sqlite_dash(): self.df = self.df.append(df_kpi_tmp, ignore_index=True) self.conn = sqlite3.connect(self.database) - self.df.to_sql(self.table,self.conn,if_exists='append') + try: + self.df.to_sql(self.table,self.conn,if_exists='append') + except: + print("attempt to append to database with different column layout, casused exception, input new name --database ") + exit(1) self.conn.close() def generate_graph_png(self):