psql-shell

1.3.5 • Public • Published

psql-shell

Enhanced postgres shell with better support for PowerShell and JSON.

npm Package Version

Features

  • Able to display all Chinese characters (unicode) in Windows PowerShell
  • Display aggregated result in prettified JSON format
  • Load database credential from .env or cli
  • support running SQL and Knex queries

npx cli

  • psql-shell
  • psql (alias)

Supported Commands

  • \l (list all databases)
  • \c database (connect to the database)
  • \d (list all tables)
  • \d+ (list each table name with row count)
  • \d table (show table schema)
  • \q (quit)
  • query; (run sql query)

Installation (optional)

npm i -g psql-shell

Usage

Usage with global install:

psql-shell

Usage without global install:

npx -y psql-shell

Database Credential

The connection credential, e.g. username, password, and database name are loaded in multiple places, including:

  • command line arguments
  • environment variables
  • .env file
  • ask from cli interactively

Name of arguments:

  • -d database name (-d is optional)
  • -U user name (-U is optional after database name)
  • -h database server host (default: localhost)
  • -P database server port (default: 5432)

(-W and -w are ignored)

Name of environment variables:

  • DB_NAME
  • DB_USER or DB_USERNAME
  • DB_PASS or DB_PASSWORD
  • DB_HOST or DB_HOSTNAME (default: localhost)
  • DB_PORT (default: 5432)

License

This project is licensed with BSD-2-Clause

This is free, libre, and open-source software. It comes down to four essential freedoms [ref]:

  • The freedom to run the program as you wish, for any purpose
  • The freedom to study how the program works, and change it so it does your computing as you wish
  • The freedom to redistribute copies so you can help others
  • The freedom to distribute copies of your modified versions to others

Package Sidebar

Install

npm i psql-shell

Weekly Downloads

1

Version

1.3.5

License

BSD-2-Clause

Unpacked Size

15.1 kB

Total Files

4

Last publish

Collaborators

  • beenotung