Take lightning fast snapshots of your local Postgres databases.
Project description
Database Snapshot, List, and Restore
Take lightning fast snapshots of your local Postgres databases.
What is this?
DSLR is a tool that allows you to quickly take and restore database snapshots when you're writing database migrations, switching branches, or messing with SQL.
It's meant to be a spiritual successor to Stellar.
Important: DSLR is intended for development use only. It is not advisable to use DSLR on production databases.
Performance
DSLR is really fast.
Impressive chart goes here
Install
pip install DSLR
DSLR requires that the Postgres client binaries (psql
, createdb
, dropdb
)
are present in your PATH
. DSLR uses them to interact with Postgres.
Usage
First you need to point DSLR to the database you want to take snapshots of. The
easiest way to do this is to export the DATABASE_URL
environment variable.
export DATABASE_URL=postgres://username:password@host:port/database_name
Alternatively, you can pass the connection string via the --db
option.
You're ready to use DSLR!
$ dslr snapshot my-first-snapshot
Created new snapshot my-first-snapshot
$ dslr restore my-first-snapshot
Restored database from snapshot my-first-snapshot
$ dslr list
Name Created
────────────────────────────────────
my-first-snapshot 2 minutes ago
$ dslr rename my-first-snapshot fresh-db
Renamed snapshot my-first-snapshot to fresh-db
$ dslr delete some-old-snapshot
Deleted some-old-snapshot
$ dslr export my-feature-test
Exported snapshot my-feature-test to my-feature-test_20220730-075650.dump
$ dslr import snapshot-from-a-friend_20220730-080632.dump friend-snapshot
Imported snapshot friend-snapshot from snapshot-from-a-friend_20220730-080632.dump
How does it work?
DSLR takes snapshots by cloning databases using Postgres' Template Databases functionality. This is the main source of DSLR's speed.
This means that taking a snapshot is just creating a new database using the main database as the template. Restoring a snapshot is just deleting the main database and creating a new database using the snapshot database as the template. So on and so forth.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file DSLR-0.1.1.tar.gz
.
File metadata
- Download URL: DSLR-0.1.1.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e9c0b543e1f077082cf5543d2fb7b3a9977f346ab975a3d66154c614324d87c |
|
MD5 | f4eb8e3cffd05ee8a5485a0db6b42a8c |
|
BLAKE2b-256 | 3c4d0314e329b33dfdff6a7669177f8402d24e1725ce4f0fc1bf0dccdc1644a3 |
File details
Details for the file DSLR-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: DSLR-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17386f260418a9234f3ffc50c9e03eba085437ee0647ed5e35a1421dc9786df0 |
|
MD5 | ab4fb6ebfa2daa4bc600e9420b8a7196 |
|
BLAKE2b-256 | befaea795c3df245dc937b0de1da4736a851135c8c8e7a997b64076b18d6fc47 |