Utility for synchronizing parallel PostgreSQL databases on Heroku, local, and remote servers
Project description
Utility for synchronizing parallel PostgreSQL databases on Heroku, local, and remote servers
Like my work? Tip me! https://www.paypal.me/jessamynsmith
Features
Easily copy databases between locations, e.g.:
Initialize a Heroku database with local data
Update local development database with the latest data in your Heroku app
Update one Heroku app (e.g. staging) with the data from another app (e.g. production)
Installation
You can get paragres from PyPI with:
pip install paragres
The development version can be installed with:
pip install -e git://github.com/jessamynsmith/paragres.git#egg=paragres
If you are developing locally, your version can be installed from the working directory with:
python setup.py.install
Usage
Note 1: To use paragres to access a Heroku app, you must be logged into the Heroku account that owns that app.
Note 2: By default, Heroku’s new pg:backups command is used. if you want to use the old pgbackups addon, you must specify –use-pgbackups
Example 1, copying data between Heroku databases:
paragres -s <source_heroku_app_name> -d <destination_heroku_app_name>
Example 2, copying a new backup snapshot of data from a Heroku database to localhost:
paragres -s <heroku_app_name> -c -t path/to/db_settings.py
Example 3, creating a backup snapshot of a Heroku database:
paragres -c -s <heroku_app_name>
db_settings.py must contain at least the following (Django settings file format):
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': '<db_name>', 'USER': '<username>', 'PASSWORD': '<password>', 'HOST': '<host>', 'PORT': '<port>', } }
Supported transfers:
Destination |
|||
---|---|---|---|
postgres |
Heroku app |
||
Source |
local file |
X |
|
postgres |
X |
X * |
|
url |
X |
X |
|
Heroku app |
X |
X |
* Can only push from a database accessible to the local user, or accessible to a user configured via PG* environment variables
Full list of optional arguments:
-h, --help show this help message and exit
--version Show program's version number
-f FILE, --file FILE PostgreSQL dump file to use as a data source
-u URL, --url URL Public URL from which to pull db file
-s SOURCE_APP, --source-app SOURCE_APP
Heroku app from which to pull db
-c, --capture Capture a new Heroku backup
-o SOURCE_SETTINGS, --source-settings SOURCE_SETTINGS
Django-style settings file with database connection information for source database
(or 'DJANGO_SETTINGS_MODULE' to use that environment variable's value)
-b SOURCE_DBNAME, --source-dbname SOURCE_DBNAME
Source database name (overrides value in source settings if both are specified)
-d DESTINATION_APP, --destination-app DESTINATION_APP
Heroku app for which to replace db
-t SETTINGS, --settings SETTINGS
Django-style settings file with database connection information for destination database
(or 'DJANGO_SETTINGS_MODULE' to use that environment variable's value)
-n DBNAME, --dbname DBNAME
Destination database name (overrides value in settings if both are specified)
-v VERBOSITY, --verbosity VERBOSITY
Verbosity level: 0=minimal output, 1=normal output
--use-pgbackups Use the deprecated pgbackups addon rather than Heroku pg:backups
Development
Fork the project on github and git clone your fork, e.g.:
git clone https://github.com/<username>/paragres.git
Create a virtualenv and install dependencies:
mkvirtualenv paragres pip install -r requirements/package.txt -r requirements/test.txt
Run tests with coverage (should be 100%) and check code style:
coverage run -m nose coverage report -m flake8
Verify all supported Python versions:
pip install tox tox
Install your local copy:
python setup.py install
Project details
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 paragres-0.6.3.tar.gz
.
File metadata
- Download URL: paragres-0.6.3.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3c46f81576487e30a5223c39e7712fcdb971cb6213df6bc732225221805ce1f |
|
MD5 | 758ac254657f22182b7b7c0944174593 |
|
BLAKE2b-256 | 7e9d93e608ce1f144835679ecc8a6af7072ae48f14f213e8346bafdf32c44e36 |
File details
Details for the file paragres-0.6.3-py2-none-any.whl
.
File metadata
- Download URL: paragres-0.6.3-py2-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a631acfde0c37cb72243cc44bd966bc66237b1a48678ea05a0f515b475743b3 |
|
MD5 | f3aa576813be8486b0b47bfce0e67447 |
|
BLAKE2b-256 | aac1f8e51e97c1fb39ca538fd8207172c5ec85ab6cc573f428d7c70ce028c376 |