Supa DB Backup is a Python application that allows you to create backups of your PostgreSQL database. It uses the pg_dump utility from PostgreSQL 15 to create a backup and saves it to a specified directory.
- Python 3.6 or higher
- PostgreSQL 15
pg_dumputility from PostgreSQL 15 installed and accessible in your system's PATH- A
.envfile containing your database credentials
- Clone this repository to your local machine.
- Navigate to the directory where you cloned the repository.
- Create a
.envfile in the same directory asconfig.pywith the following variables:
SUPA_PASSWORD=your_database_password
SUPA_ID=your_supabase_id
SUPA_PORT=your_database_port
SUPA_USER=your_database_usernameReplace your_database_password, your_supabase_id, your_database_port, and your_database_username with your actual database credentials.
To run the Supa DB Backup utility, navigate to the directory containing the main.py file and run the following command:
python main.pyThis will create a backup of your PostgreSQL database and save it to the backups directory. The backup file will be named in the format DB_NAME-YYYY-MM-DD_HH-MM-SS.sql, where DB_NAME is the name of your database and YYYY-MM-DD_HH-MM-SS is the current date and time.
- The
DB_NAMEvariable inconfig.pyis used for the name of the backup file and must be set manually. - The
SUPA_URLvariable inconfig.pyis generated from theSUPA_IDvariable and should not be changed. - The Supa DB Backup utility uses the
pg_dumpcommand from PostgreSQL 15 to create the backup. Make surepg_dumpfrom PostgreSQL 15 is installed and accessible in your system's PATH. - The Supa DB Backup utility does not handle errors during the backup process. If an error occurs, it will be printed to the console.