30 lines
827 B
Python
Executable File
30 lines
827 B
Python
Executable File
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}") |