Skip to main content

A helper for Postgres + Docker that works for free

https://travis-ci.org/crccheck/postdoc.png?branch=master

About

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
DATABASE_URL=postgres://docker@127.0.0.1/elevators

You could type:

$ createdb -U docker -h 127.0.0.1 elevators
createdb elevators

Or with PostDoc:

$ phd createdb
createdb -U docker -h 127.0.0.1 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 127.0.0.1 --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 127.0.0.1 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

Installation

Install with pip:

pip install postdoc

Extras

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.

Aliases:

alias dphd="phd --postdoc-dry-run"
alias qphd="phd --postdoc-quiet"
http://i.imgur.com/qqperK4.jpg

Release files for postdoc 1.0.0

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

Source distribution (sdist)

Source distribution for postdoc 1.0.0
File Size Uploaded
postdoc-1.0.0.tar.gz 3.8 kB Details

Built distribution (wheel)

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

Total release size: 9.6 kB

Release files / postdoc-1.0.0.tar.gz

Download URL postdoc-1.0.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
14add5fc362de8f4738eda349b4c3f504437ef2c4d8cce04ec7a2e10ef00db23
BLAKE2b-256 checksum
How to use checksums
0f37ba289577d4c4aee1b5b6aeae94291f5c46182513e7c25be06d034133453a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / postdoc-1.0.0-py3-none-any.whl

Download URL postdoc-1.0.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
879a1c896e89bd2bb4cda97a08a0f1a835b7bfa48017024ad470564523cd3a7c
BLAKE2b-256 checksum
How to use checksums
4379d673a0cdc97d9879476301b1b9e238e9628175a7de424e2b46548886004f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.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