admiralorbiter / DataDeck

EngageKC is an innovative platform designed to enhance classroom collaboration and digital interaction within educational settings. Allowing students to easily upload video and pictures without logging in for use to enhance classroom learning.
http://www.datadeck.dev
3 stars 18 forks source link

Backup System for SQLITE #23

Open admiralorbiter opened 1 month ago

admiralorbiter commented 1 month ago

Currently using SQLite's backup feature using this python script

import sqlite3
import os
from datetime import datetime

def backup_db(db_path, backup_path):
    conn = sqlite3.connect(db_path)
    backup_conn = sqlite3.connect(backup_path)
    with backup_conn:
        conn.backup(backup_conn)
    backup_conn.close()
    conn.close()

if __name__ == '__main__':
    db_path = 'db.sqlite3'
    backup_path = f'backup_{datetime.now().strftime("%Y%m%d_%H%M%S")}.db'
    backup_db(db_path, backup_path)
    print(f'Database backup successful: {backup_path}')

Need to work on a pipeline to

admiralorbiter commented 1 month ago

For now, This page should get me started to setup a backup script. Will do twice a day backups and manually offsite backups until we figure out an automation process.