Skip to content
This repository has been archived by the owner. It is now read-only.
A command line tool that generates markdown documentation for Postgres tables in a given schema
Python
Branch: master
Clone or download
projectweekend Merge pull request #14 from cssho/add_max_length
Support display maximum length of character varying.
Latest commit 12e5a16 Oct 5, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pg_table_markdown Support display maximum length of character varying. Oct 4, 2016
.drone.sec
.drone.yml Sort results Dec 14, 2015
.gitignore Initial commit Dec 10, 2015
AUTHORS.md Fix github links Jan 7, 2016
Dockerfile Run tests with Docker Compose Dec 11, 2015
LICENSE Initial commit Dec 10, 2015
README.md Support display maximum length of character varying. Oct 4, 2016
SAMPLE_TABLES.md Add sample output Jan 6, 2016
docker-compose.yml Run tests with Docker Compose Dec 11, 2015
requirements.txt Run tests with Docker Compose Dec 11, 2015
setup.py Bump version Jan 6, 2016
tests.py Support display maximum length of character varying. Oct 4, 2016

README.md

A command line tool that generates Markdown documentation for Postgres tables in a given schema.

Installation

pip install pg-table-markdown

Note: Since pg-table-markdown is intended to connect to Postgres databases, it has a dependedncy on psycopg2. However, psycopg2 includes compiled C modules, and therefore may require compiling from source if it's not already installed. Installing via pip will require python-dev and libpq-dev. psycopg2 maintainers generally recommend installing from binary instead.

Usage

Usage: pgtablemd [OPTIONS]

  Export Postgres table documentation to a markdown file

Options:
  --database_url TEXT  Database connection URL
  --table_schema TEXT  Postgres table_schema, default is: public
  --output_file TEXT   Path for generated markdown file
  --max_length         To display maximum length of character varying, default is: False
  --help               Show this message and exit.

Note: For those unfamiliar with Postgres database connection URLs, they use the following format:

postgres://username:password@host:port/dbname

Sample Output

The generated Markdown details the column name, type, and default value for each table defined in your schema. It also displays nicely in GitHub (see more here).

app_users

Column Type Default Nullable
id integer nextval('app_users_id_seq'::regclass) NO
email character varying None NO
password character varying None YES
is_active boolean true YES
is_admin boolean false YES

Run tests with Docker Compose

docker-compose run cli nosetests -v
You can’t perform that action at this time.