Skip to main content

A helper for Postgres + Docker that works for free

Project description

A helper for Postgres + Docker that works for free


A wrapper that wraps a postgres command with connection arguments according to the DATABASE_URL environment variable.

I originally made this because manually typing the connection args to pqsl, createdb, etc. became tiring. “Ain’t nobody got time for dat”.

Let’s say your environment is like this:

$ env | grep DATABASE_URL

You could type:

$ createdb -U docker -h elevators
createdb elevators

Or with PostDoc:

$ phd createdb
createdb -U docker -h elevators
createdb elevators

Docker doesn’t really have anything to do with this. But now that I’ve been using Docker to manage my Postgres databases, I can’t use defaults anymore.

But wait, there’s more!

You can do MySQL stuff too:

$ phd mysql
mysql -u docker -h --database elevators
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

$ phd mysqlcheck --auto-repair
mysqlcheck -u docker -h elevators --auto-repair

If your database url isn’t DATABASE_URL, you can connect to it by making it the first argument:

$ export FATTYBASE_URL=postgres://fatty@fat/phat
$ phd FATTYBASE_URL psql
psql -U fatty -h fat phat


Install with pip:

pip install postdoc


Add the flag –postdoc-dry-run to just print the command.

Add the flag –postdoc-quiet to execute the command without printing the debugging line.


alias dphd="phd --postdoc-dry-run"
alias qphd="phd --postdoc-quiet"

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
postdoc-1.0.0-py3-none-any.whl (5.8 kB) Copy SHA256 hash SHA256 Wheel 3.6 Mar 24, 2018
postdoc-1.0.0.tar.gz (3.8 kB) Copy SHA256 hash SHA256 Source None Mar 24, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page