edwh plugin for quick database snapshot creation and recovery
Project description
EDWH Development Database (devdb) Plugin
Overview
The EDWH Development Database Plugin provides a comprehensive set of tools for managing snapshots of the development database. This plugin allows developers to create, push, pop, recover, and list database snapshots efficiently.
Features
- Snapshot Management: Create and manage snapshots of the development database.
- Selective Exclusion: Optionally exclude specific tables during snapshot creation.
- Remote Operations: Push and pop snapshots to/from a remote server.
- Database Recovery: Recover the database from previously created snapshots.
- Environment Setup: Easy setup of environment variables for PostgreSQL connections.
Requirements
- Python 3.12+
- Docker Compose
- PostgreSQL
- EDWH environment variables configured (usually via
edwh setup)
Installation
Development Installation
To install the plugin in development mode, run:
uv pip install -e .[dev]
Production Installation
For production use, you can install the plugin using:
uvenv install edwh[devdb]
Alternatively, you can add the plugin directly with:
edwh plugin.add devdb
Usage
Environment Variables
Ensure the following environment variables are set:
POSTGRES_USERNAME: Username for PostgreSQL (default:postgres)POSTGRES_PASSWORD: Password for PostgreSQL (default:password)PGPOOL_PORT: Port for pgpool (default:5432)POSTGRES_DATABASE: Name of the PostgreSQL database (default:backend)
Then you can run edwh setup and the other required variables can be infered.
Commands
Create a Snapshot
To create a snapshot of the development database:
ew devdb.snapshot
You can exclude specific tables using optional parameters:
ew devdb.snapshot --without_api_activity False --without_applog False
List Snapshots
To list all snapshots in reverse chronological order:
ew devdb.list
Rename a Snapshot
To rename the most recent snapshot:
ew devdb.rename <new_name>
Push a Snapshot
To push the local snapshot to a remote server:
ew devdb.push
Pop a Snapshot
To download and prepare a snapshot from a given URL:
ew devdb.pop <url>
Recover a Snapshot
To recover the database from a snapshot:
ew devdb.recover
This assumes an empty database. An easier alternative is:
Reset the Database
To reset your database to the latest state:
ew devdb.reset
Notes
- Be cautious when using the
resetcommand as it will clear your PostgreSQL database and remove all existing data.
Repository
The source code is available at GitHub.
License
This project is licensed under the MIT License.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file edwh_devdb_plugin-0.7.2.tar.gz.
File metadata
- Download URL: edwh_devdb_plugin-0.7.2.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60a91066352da03b5de7d332c92f8f6af45ea19d18220bf9ca64594686ab9af2
|
|
| MD5 |
5efaecd9db78a388cdb7ca7e9e03b0e4
|
|
| BLAKE2b-256 |
2f1dfda6cb7a55ee2b75f0057f4add23c5d596c824f9d74e803d766f5c37092f
|
File details
Details for the file edwh_devdb_plugin-0.7.2-py3-none-any.whl.
File metadata
- Download URL: edwh_devdb_plugin-0.7.2-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13fb7b227bb9faa3efea4d661b91744f85b2a67ea2a1ff7a370c70071d9db6b2
|
|
| MD5 |
ea01357c846542bfad922aa824e190a1
|
|
| BLAKE2b-256 |
82badf21fe91bd9071295b204fe987ba70c5cb7d8a1bd96d4fad865ec01bea1e
|