import sqlite3 import json # Connetti al database conn = sqlite3.connect('scheduler.db') conn.row_factory = sqlite3.Row cursor = conn.cursor() print("=" * 80) print("BACKUP PROFILES:") print("=" * 80) cursor.execute("SELECT * FROM backup_profiles") for row in cursor.fetchall(): print(f"ID: {row['id']}, Name: {row['name']}, Enabled: {row['enabled']}") print(f" Backup Root: {row['backup_root']}") print(f" Sources: {row['sources']}") print() print("=" * 80) print("BACKUP SCHEDULES:") print("=" * 80) cursor.execute(""" SELECT s.*, bp.name as backup_name FROM schedules s LEFT JOIN backup_profiles bp ON s.target_id = bp.id AND s.target_type = 'backup_profile' WHERE s.target_type = 'backup_profile' """) for row in cursor.fetchall(): print(f"Schedule ID: {row['id']}, Name: {row['name']}") print(f" Backup Profile: {row['backup_name']} (ID: {row['target_id']})") print(f" Schedule Type: {row['schedule_type']}") print(f" Schedule Config: {row['schedule_config']}") print(f" Enabled: {row['enabled']}") print() print("=" * 80) print("BACKUP OPERATIONS (HISTORY):") print("=" * 80) cursor.execute("SELECT * FROM backup_operations ORDER BY start_time DESC LIMIT 10") rows = cursor.fetchall() if rows: for row in rows: print(f"ID: {row['id']}, Profile: {row['profile_id']}, Status: {row['status']}") print(f" Start: {row['start_time']}, End: {row['end_time']}") print(f" Files: {row['files_total']}, Size: {row['total_size_bytes']}") if row['error_message']: print(f" Error: {row['error_message']}") print() else: print("No backup operations found in history") print() print("=" * 80) print("ALL ENABLED SCHEDULES (ANY TYPE):") print("=" * 80) cursor.execute("SELECT id, name, target_type, schedule_type, enabled FROM schedules WHERE enabled = 1") for row in cursor.fetchall(): print(f"ID: {row['id']}, Name: {row['name']}, Type: {row['target_type']}, Schedule: {row['schedule_type']}, Enabled: {row['enabled']}") conn.close()