1.3.5 • Published 2 years ago
psql-shell v1.3.5
psql-shell
Enhanced postgres shell with better support for PowerShell and JSON.
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-shellpsql(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-shellUsage
Usage with global install:
psql-shellUsage without global install:
npx -y psql-shellDatabase 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:
-ddatabase name (-dis optional)-Uuser name (-Uis optional after database name)-hdatabase server host (default: localhost)-Pdatabase server port (default: 5432)
(-W and -w are ignored)
Name of environment variables:
DB_NAMEDB_USERorDB_USERNAMEDB_PASSorDB_PASSWORDDB_HOSTorDB_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