feat: Implement comprehensive database setup system
- Add complete database setup script (setup_complete_database.py) - Add quick deployment script (quick_deploy.sh) - Add comprehensive documentation (DATABASE_SETUP_README.md) - Move individual db scripts to backup_db_scripts folder - Update external_server.conf with correct database settings - Clean up obsolete documentation files - Streamline deployment process to single command Features: - One-script database creation for all tables and triggers - Automated permissions and roles setup - Complete verification and error handling - Production-ready deployment workflow - Maintains backward compatibility with individual scripts
This commit is contained in:
34
py_app/app/backup_db_scripts/query.py
Executable file
34
py_app/app/backup_db_scripts/query.py
Executable file
@@ -0,0 +1,34 @@
|
||||
import mariadb
|
||||
|
||||
# Database connection credentials
|
||||
db_config = {
|
||||
"user": "trasabilitate",
|
||||
"password": "Initial01!",
|
||||
"host": "localhost",
|
||||
"database": "trasabilitate_database"
|
||||
}
|
||||
|
||||
try:
|
||||
# Connect to the database
|
||||
conn = mariadb.connect(**db_config)
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Query to fetch all records from the scan1 table
|
||||
query = "SELECT * FROM scan1_orders ORDER BY Id DESC LIMIT 15"
|
||||
cursor.execute(query)
|
||||
|
||||
# Fetch and print the results
|
||||
rows = cursor.fetchall()
|
||||
if rows:
|
||||
print("Records in the 'scan1_orders' table:")
|
||||
for row in rows:
|
||||
print(row)
|
||||
else:
|
||||
print("No records found in the 'scan1_orders' table.")
|
||||
|
||||
# Close the connection
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
except mariadb.Error as e:
|
||||
print(f"Error connecting to the database: {e}")
|
||||
Reference in New Issue
Block a user