diff --git a/py_app/app/db_create_scripts/delet scan1_orders values.py b/py_app/app/db_create_scripts/delet scan1_orders values.py new file mode 100644 index 0000000..a4f2050 --- /dev/null +++ b/py_app/app/db_create_scripts/delet scan1_orders values.py @@ -0,0 +1,30 @@ +import mariadb + +# Database connection credentials +def get_db_connection(): + return mariadb.connect( + user="trasabilitate", # Replace with your username + password="Initial01!", # Replace with your password + host="localhost", # Replace with your host + port=3306, # Default MariaDB port + database="trasabilitate_database" # Replace with your database name + ) + +try: + # Connect to the database + conn = get_db_connection() + cursor = conn.cursor() + + # Delete query + delete_query = "DELETE FROM scan1_orders" + cursor.execute(delete_query) + conn.commit() + + print("All data from the 'scan1_orders' table has been deleted successfully.") + + # Close the connection + cursor.close() + conn.close() + +except mariadb.Error as e: + print(f"Error deleting data: {e}") \ No newline at end of file diff --git a/py_app/app/query.py b/py_app/app/db_create_scripts/query.py similarity index 100% rename from py_app/app/query.py rename to py_app/app/db_create_scripts/query.py diff --git a/py_app/app/test.py b/py_app/app/db_create_scripts/test.py similarity index 100% rename from py_app/app/test.py rename to py_app/app/db_create_scripts/test.py