Skip to content

DuncBoi/SupabaseBackupScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Supabase Postgres Backup Script

A lightweight Python script to back up your Supabase Postgres database—one-time or on a recurring schedule.


Requirements

  • Python 3.8+
  • pg_dump (PostgreSQL client tool)
  • pip (Python package installer)
  • A Supabase Project

Quickstart

Clone this repo and run the setup script:

git clone https://github.com/DuncBoi/SupabaseBackupScript.git
cd SupabaseBackupScript
bash setup.sh

Activate your environment and run the backup script:

source .venv/bin/activate
python supabase_backup.py

The script will guide you:

  • Where to get your Supabase "Transaction Pooler" database URL
  • Where to save the backup
  • How to schedule recurring backups
  • How to overwrite or keep separate backups

Scheduling (Recurring Backups)

If you choose to schedule, the script will generate a cron job for you and explain how to use/remove it. You can view or edit scheduled jobs at any time:

crontab -e

To remove the scheduled backup, simply delete the backup line from your crontab file.


Uninstall

To remove your virtual environment and backup files:

deactivate  # (if you're in the venv)
rm -rf .venv supabase_backup_*.dump

Troubleshooting

  • Make sure pg_dump is installed and in your PATH.

    • On macOS: brew install postgresql
    • On Ubuntu/Debian: sudo apt-get install postgresql-client
    • On Windows: Install from postgresql.org
  • If you get connection errors, double-check your Supabase database URL and password.

  • If cron jobs don't run as expected, make sure your machine is on and not asleep at the scheduled time.


About

Built with rich for terminal UI.

Author: Duncan Greene

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors