SnapFlow is a high-performance database snapshot and restore tool designed for modern development workflows. Create instant database snapshots, switch between states effortlessly, and accelerate your development cycle.
- Lightning Fast: Restore databases up to 140x faster than traditional dump/restore methods
- Multi-Database Support: PostgreSQL and MySQL support out of the box
- Smart Snapshots: Automatic background copying for zero-downtime restores
- Developer Friendly: Simple CLI commands for everyday workflows
- Project-Based: Manage multiple projects with isolated snapshots
- Safe & Reliable: Built-in safeguards and error handling
SnapFlow revolutionizes database management during development:
- Branch Switching: Instantly switch database states when changing git branches
- Migration Testing: Test database migrations without fear
- Data Experiments: Try risky SQL queries with instant rollback capability
- Clean State: Return to a pristine database state in seconds
pip install snapflowcd your-project
snapflow initFollow the interactive setup wizard to configure your database connection.
# Create a snapshot
snapflow snapshot baseline
# Make changes to your database...
# Made a mistake? Restore instantly!
snapflow restore baseline
# List all snapshots
snapflow list
# Remove old snapshots
snapflow remove old-snapshotInitialize SnapFlow configuration for your project. Creates a snapflow.yaml file with your database settings.
Create a new snapshot of your database. If no name is provided, an auto-generated name is used.
snapflow snapshot before-migrationRestore your database from a snapshot. If no name is provided, restores from the most recent snapshot.
snapflow restore before-migrationDisplay all snapshots for the current project with creation timestamps.
snapflow listDelete a specific snapshot.
snapflow remove old-snapshotRename an existing snapshot.
snapflow rename snap1 baselineReplace an existing snapshot with the current database state.
snapflow replace baselineClean up orphaned snapshot databases (garbage collection).
snapflow gcDisplay the current SnapFlow version.
snapflow versionSnapFlow uses a snapflow.yaml file in your project directory:
project_name: 'myproject'
tracked_databases: ['myproject_db']
url: 'postgresql://localhost:5432/template1'
stellar_url: 'postgresql://localhost:5432/snapflow_data'
logging: 20 # Optional: 10=DEBUG, 20=INFO, 30=WARNINGPro Tip: Add snapflow.yaml to your .gitignore to keep database credentials private.
SnapFlow uses a clever approach to achieve blazing-fast restores:
- Snapshot Creation: Creates a copy of your database using native RDBMS features
- Background Duplication: Automatically creates a secondary copy in the background
- Instant Restore: Restores by simply renaming the database (microseconds instead of minutes)
- Smart Recovery: Regenerates the secondary copy after restore for the next operation
This approach trades storage space for speed, making it ideal for development environments.
SnapFlow stores copies of your database, so plan accordingly:
- Each snapshot requires approximately 2x your database size (master + slave copies)
- Use
snapflow gcregularly to clean up unused snapshots - Consider disk space when creating multiple snapshots
- Development Only: SnapFlow is designed for development environments, not production
- Data Loss Risk: While rare, data loss is possible. Don't use for critical data without backups
- Storage Space: Ensure adequate disk space for database copies
- Permissions: Requires database user with CREATE DATABASE permissions
- β Fully supported
- β Fast template-based copying
- β Connection termination for clean operations
β οΈ Supported with limitationsβ οΈ Slower copying (table-by-table)- β PyMySQL driver recommended
Track multiple databases in a single project:
tracked_databases:
- 'main_db'
- 'analytics_db'
- 'cache_db'PostgreSQL:
postgresql://user:password@localhost:5432/
MySQL with PyMySQL:
mysql+pymysql://root:password@localhost/
Ensure your database user has CREATE DATABASE permissions:
-- PostgreSQL
ALTER USER myuser CREATEDB;
-- MySQL
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'localhost';PostgreSQL users need a database matching their username:
createdb $USERMySQL uses table-by-table copying. Consider:
- Using PostgreSQL for better performance
- Reducing database size during development
- Using SSD storage
Contributions are welcome! Please feel free to submit issues and pull requests.
SnapFlow is released under the MIT License. See LICENSE file for details.
SnapFlow builds upon database management concepts and is inspired by the need for faster development workflows.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@quantumdb.dev
Made with β€οΈ by the QuantumDB Team
SnapFlow - Because developers deserve better database tools.