From f25c7e399a46629d6e6697e816dbfd82ad20e97a Mon Sep 17 00:00:00 2001 From: COMMANDO2406 Date: Wed, 10 Jul 2024 17:06:37 +0530 Subject: [PATCH] added print statements --- src/gui.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui.py b/src/gui.py index 87e8f3e..bc955d5 100644 --- a/src/gui.py +++ b/src/gui.py @@ -98,6 +98,7 @@ def import_data(self): columns = [f"{col.strip()} varchar(255)" for col in column_names.split(",")] create_table_query = f"CREATE TABLE IF NOT EXISTS {table_name} ({', '.join(columns)})" + # print(f"Create Table Query: {create_table_query}") cur.execute(create_table_query) with open(csv_file_path, "r") as file: @@ -107,12 +108,15 @@ def import_data(self): for row in reader: insert_query = f"INSERT INTO {table_name} ({', '.join(column_names.split(','))}) values ({', '.join(['%s'] * len(row))})" values = tuple(row) + # print(f"Insert Query: {insert_query}, Values: {values}") cur.execute(insert_query, values) con.commit() con.close() + print("Data imported successfully.") QMessageBox.information(self, 'Success', 'Data imported successfully.') except mysql.connector.Error as err: + print(f"Error: {err}") QMessageBox.critical(self, 'Error', f"Error: {err}") if __name__ == '__main__':