Skip to main content



PyPI version PyPI Supported Python Versions GitHub Actions (Code quality and tests)



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

Release files for DSLR 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DSLR 0.1.1
File Size Uploaded
DSLR-0.1.1.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for DSLR 0.1.1
File Interpreter ABI Platform
DSLR-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.2 kB

Release files / DSLR-0.1.1.tar.gz

Download URL DSLR-0.1.1.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2e9c0b543e1f077082cf5543d2fb7b3a9977f346ab975a3d66154c614324d87c
BLAKE2b-256 checksum
How to use checksums
3c4d0314e329b33dfdff6a7669177f8402d24e1725ce4f0fc1bf0dccdc1644a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.0

Release files / DSLR-0.1.1-py3-none-any.whl

Download URL DSLR-0.1.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17386f260418a9234f3ffc50c9e03eba085437ee0647ed5e35a1421dc9786df0
BLAKE2b-256 checksum
How to use checksums
befaea795c3df245dc937b0de1da4736a851135c8c8e7a997b64076b18d6fc47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.0
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page