fastapi-dbbackup
Database-native backup tool for FastAPI, SQLAlchemy, and SQLModel projects. Similar to django-dbbackup.
Features
- Database Support: SQLite, PostgreSQL, MySQL (SQL-only).
- Storage Support: Local File System, AWS S3, DigitalOcean Spaces.
- Direct Streaming: Direct pipe from database to cloud for Postgres/MySQL (No local disk usage).
- Compression: Gzip compression supported (including streaming compression).
- Security: Secure credential handling via environment variables (no passwords in process lists).
- Restoration: Easy database restoration from backups.
- Retention: Automatic purging of old backups.
- CLI: Intuitive CLI with
backup,restore, andlistcommands.
Database Version Support
| Database | Supported Versions | Requirement |
|---|---|---|
| PostgreSQL | All (9.x - 17+) | pg_dump client version ≥ Server version |
| MySQL | All (5.7, 8.0+) | mysqldump client version ≥ Server version |
| SQLite | All | No special requirements |
Quick Start
-
Install:
-
Configure: Create a
.envfile: -
Backup:
Docker Usage
fastapi-dbbackup works great with Docker. Because it uses native database CLI tools, you must ensure the appropriate clients are installed in your container.
We provide separate guides and Dockerfile examples for each database backend:
See the full Docker Usage guide for more details.