"""Consistent copy of the live database (safe while the app runs): _Data/backups/french_grades-<time>.db"""
import os, sqlite3, time
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
src_path = os.path.join(ROOT, "..", "_Data", "french_grades.db")
dst_path = os.path.join(ROOT, "..", "_Data", "backups", time.strftime("french_grades-%Y%m%d-%H%M%S.db"))
src, dst = sqlite3.connect(src_path), sqlite3.connect(dst_path)
src.backup(dst); src.close(); dst.close()
print("backup:", os.path.normpath(dst_path), os.path.getsize(dst_path), "bytes")
