@hesed/psql
v0.5.1
Published
CLI for PostgreSQL database interaction
Readme
psql
CLI for PostgreSQL database interaction
Install
sdkck plugins install @hesed/psqlUsage
$ npm install -g @hesed/psql
$ pg COMMAND
running command...
$ pg (--version)
@hesed/psql/0.5.1 linux-x64 node-v24.17.0
$ pg --help [COMMAND]
USAGE
$ pg COMMAND
...Commands
pg psql auth addpg psql auth deletepg psql auth listpg psql auth profilepg psql auth testpg psql auth updatepg psql databasespg psql describe-table TABLEpg psql explain-query QUERYpg psql indexes TABLEpg psql query QUERYpg psql tables
pg psql auth add
Add PostgreSQL authentication
USAGE
$ pg psql auth add -p <value> --host <value> --port <value> -u <value> --password <value> -d <value> --ssl
[--json]
FLAGS
-d, --database=<value> (required) Database name
-p, --profile=<value> (required) Profile name
-u, --user=<value> (required) Username
--host=<value> (required) PostgreSQL host
--password=<value> (required) Password
--port=<value> (required) PostgreSQL port
--ssl (required) Use SSL
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Add PostgreSQL authentication
EXAMPLES
$ pg psql auth add
$ pg psql auth add -p prodSee code: src/commands/psql/auth/add.ts
pg psql auth delete
Delete an authentication profile
USAGE
$ pg psql auth delete [--json] [-p <value>]
FLAGS
-p, --profile=<value> Profile to delete
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Delete an authentication profile
EXAMPLES
$ pg psql auth delete
$ pg psql auth delete -p prodSee code: src/commands/psql/auth/delete.ts
pg psql auth list
List authentication profiles
USAGE
$ pg psql auth list [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List authentication profiles
EXAMPLES
$ pg psql auth listSee code: src/commands/psql/auth/list.ts
pg psql auth profile
Set or show the default authentication profile
USAGE
$ pg psql auth profile [--json] [--default <value>]
FLAGS
--default=<value> Profile to set as default
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Set or show the default authentication profile
EXAMPLES
$ pg psql auth profile
$ pg psql auth profile --default testSee code: src/commands/psql/auth/profile.ts
pg psql auth test
Test authentication and connection
USAGE
$ pg psql auth test [--json] [-p <value>]
FLAGS
-p, --profile=<value> Authentication profile name
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Test authentication and connection
EXAMPLES
$ pg psql auth test
$ pg psql auth test -p prodSee code: src/commands/psql/auth/test.ts
pg psql auth update
Update PostgreSQL authentication
USAGE
$ pg psql auth update -p <value> --host <value> --port <value> -u <value> --password <value> -d <value> --ssl
[--json]
FLAGS
-d, --database=<value> (required) Database name
-p, --profile=<value> (required) Profile name
-u, --user=<value> (required) Username
--host=<value> (required) PostgreSQL host
--password=<value> (required) Password
--port=<value> (required) PostgreSQL port
--ssl (required) Use SSL
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Update PostgreSQL authentication
EXAMPLES
$ pg psql auth update
$ pg psql auth update -p testSee code: src/commands/psql/auth/update.ts
pg psql databases
List all databases accessible on the PostgreSQL server
USAGE
$ pg psql databases [--json] [-p <value>]
FLAGS
-p, --profile=<value> Database profile name from config
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List all databases accessible on the PostgreSQL server
EXAMPLES
$ pg psql databases
$ pg psql databases -p stagingSee code: src/commands/psql/databases.ts
pg psql describe-table TABLE
Describe the structure of a PostgreSQL table
USAGE
$ pg psql describe-table TABLE [--json] [--format table|json|toon] [-p <value>]
ARGUMENTS
TABLE Table name to describe
FLAGS
-p, --profile=<value> Database profile name from config
--format=<option> [default: table] Output format
<options: table|json|toon>
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Describe the structure of a PostgreSQL table
EXAMPLES
$ pg psql describe-table users
$ pg psql describe-table orders --format json -p prodSee code: src/commands/psql/describe-table.ts
pg psql explain-query QUERY
Show the execution plan for a PostgreSQL query
USAGE
$ pg psql explain-query QUERY [--json] [--format table|json|toon] [-p <value>]
ARGUMENTS
QUERY SQL query to explain
FLAGS
-p, --profile=<value> Database profile name from config
--format=<option> [default: table] Output format
<options: table|json|toon>
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show the execution plan for a PostgreSQL query
EXAMPLES
$ pg psql explain-query "SELECT * FROM users WHERE id = 1"
$ pg psql explain-query "SELECT * FROM orders JOIN users ON orders.user_id = users.id" --format jsonSee code: src/commands/psql/explain-query.ts
pg psql indexes TABLE
Show indexes for a PostgreSQL table
USAGE
$ pg psql indexes TABLE [--json] [--format table|json|toon] [-p <value>]
ARGUMENTS
TABLE Table name to show indexes for
FLAGS
-p, --profile=<value> Database profile name from config
--format=<option> [default: table] Output format
<options: table|json|toon>
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show indexes for a PostgreSQL table
EXAMPLES
$ pg psql indexes users
$ pg psql indexes orders --format json -p prodSee code: src/commands/psql/indexes.ts
pg psql query QUERY
Execute a SQL query against a PostgreSQL database
USAGE
$ pg psql query QUERY [--json] [--format table|json|csv|toon] [-p <value>] [--skip-confirmation]
ARGUMENTS
QUERY SQL query to execute
FLAGS
-p, --profile=<value> Database profile name from config
--format=<option> [default: table] Output format
<options: table|json|csv|toon>
--skip-confirmation Skip confirmation prompt for destructive operations
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Execute a SQL query against a PostgreSQL database
EXAMPLES
$ pg psql query "SELECT * FROM users LIMIT 10"
$ pg psql query "UPDATE users SET email = '[email protected]' WHERE id = 999" --format json
$ pg psql query "DELETE FROM sessions" -p prod --skip-confirmationSee code: src/commands/psql/query.ts
pg psql tables
List all tables in the current PostgreSQL database
USAGE
$ pg psql tables [--json] [-p <value>]
FLAGS
-p, --profile=<value> Database profile name from config
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List all tables in the current PostgreSQL database
EXAMPLES
$ pg psql tables
$ pg psql tables -p localSee code: src/commands/psql/tables.ts
