@hesed/psql
v0.6.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.6.1 linux-x64 node-v24.18.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 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
--maxConcurrentQueries <value> --queryQueueTimeoutMs <value> [--json]
FLAGS
-d, --database=<value> (required) Database name
-p, --profile=<value> (required) Profile name
-u, --user=<value> (required) Username
--host=<value> (required) PostgreSQL host
--maxConcurrentQueries=<value> (required) Max concurrent queries for this profile
--password=<value> (required) Password
--port=<value> (required) PostgreSQL port
--queryQueueTimeoutMs=<value> (required) Milliseconds a query may wait for a free query slot before failing
--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
--maxConcurrentQueries <value> --queryQueueTimeoutMs <value> [--json]
FLAGS
-d, --database=<value> (required) Database name
-p, --profile=<value> (required) Profile name
-u, --user=<value> (required) Username
--host=<value> (required) PostgreSQL host
--maxConcurrentQueries=<value> (required) Max concurrent queries for this profile
--password=<value> (required) Password
--port=<value> (required) PostgreSQL port
--queryQueueTimeoutMs=<value> (required) Milliseconds a query may wait for a free query slot before failing
--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] [-p <value>] [--toon]
ARGUMENTS
TABLE Table name to describe
FLAGS
-p, --profile=<value> Database profile name from config
--toon Output in toon format
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Describe the structure of a PostgreSQL table
EXAMPLES
$ pg psql describe-table users --toon
$ pg psql describe-table orders -p prodSee code: src/commands/psql/describe-table.ts
pg psql explain QUERY
Show the execution plan for a PostgreSQL query
USAGE
$ pg psql explain QUERY [--json] [-p <value>] [--toon]
ARGUMENTS
QUERY SQL query to explain
FLAGS
-p, --profile=<value> Database profile name from config
--toon Output in toon format
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show the execution plan for a PostgreSQL query
EXAMPLES
$ pg psql explain "SELECT * FROM users WHERE id = 1" --json
$ pg psql explain "SELECT * FROM orders JOIN users ON orders.user_id = users.id"See code: src/commands/psql/explain.ts
pg psql indexes TABLE
Show indexes for a PostgreSQL table
USAGE
$ pg psql indexes TABLE [--json] [-p <value>] [--toon]
ARGUMENTS
TABLE Table name to show indexes for
FLAGS
-p, --profile=<value> Database profile name from config
--toon Output in toon format
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show indexes for a PostgreSQL table
EXAMPLES
$ pg psql indexes users --json
$ pg psql indexes orders -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] [-p <value>] [--skip-confirmation] [--toon]
ARGUMENTS
QUERY SQL query to execute
FLAGS
-p, --profile=<value> Database profile name from config
--skip-confirmation Skip confirmation prompt for destructive operations
--toon Output in toon format
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" --json
$ pg psql query "UPDATE users SET email = '[email protected]' WHERE id = 999"
$ 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
