@cli4ai/postgres
v1.0.3
Published
PostgreSQL read-only queries
Maintainers
Readme
@cli4ai/postgres
Official @cli4ai package • https://cli4ai.com • Install c4ai:
npm i -g c4ai
PostgreSQL explorer with read-only queries (blocks writes by default).
Setup
npm i -g c4ai
c4ai add -g postgresConfigure a default connection using POSTGRES_URL (or DATABASE_URL):
POSTGRES_URL="postgres://user:pass@host:5432/db" c4ai run postgres databasesNamed connections are supported via env vars like POSTGRES_PROD_URL. Pass the name as [conn]:
POSTGRES_PROD_URL="postgres://..." c4ai run postgres tables prod publicCommands
c4ai run postgres databases [conn]
c4ai run postgres schemas [conn]
c4ai run postgres tables [conn] [schema]
c4ai run postgres views [conn] [schema]
c4ai run postgres columns [conn] <table>
c4ai run postgres indexes [conn] <table>
c4ai run postgres constraints [conn] <table>
c4ai run postgres fkeys [conn] <table>
c4ai run postgres sample [conn] <table> [limit]
c4ai run postgres count [conn] <table>
c4ai run postgres query [conn] <sql>
c4ai run postgres stats [conn] <table>
c4ai run postgres sizes [conn] [schema]
c4ai run postgres search [conn] <pattern>
c4ai run postgres version [conn]Examples
POSTGRES_URL="postgres://user:pass@host:5432/db" c4ai run postgres tables
POSTGRES_URL="postgres://user:pass@host:5432/db" c4ai run postgres query "select now() as now"