postgres
The postgres command provides operations on PostgreSQL database connections that are configured in your clanker configuration file. It allows you to list and manage connections defined in ~/.clanker.yaml.
Usage
clanker postgres <subcommand>Subcommands
postgres list
List all PostgreSQL connections configured in your clanker configuration file. The output includes each connection's name, host, database name, description, and whether it is the default connection.
clanker postgres listExample output:
Available PostgreSQL Connections (default: dev):
dev (default)
Host: localhost
Database: myapp_dev
Description: Development database
stage
Host: stage-db.example.com
Database: myapp_stage
Description: Staging database
prod
Host: prod-db.internal
Database: myapp_prod
Description: Production database
Usage: clanker ask --postgres <connection-name> "your database question"Configuration
PostgreSQL connections are defined in ~/.clanker.yaml under the postgres section:
postgres:
default_connection: dev
connections:
dev:
host: localhost
port: 5432
database: myapp_dev
username: postgres
description: Development database
stage:
host: stage-db.example.com
port: 5432
database: myapp_stage
username: app_user
description: Staging databaseEach connection entry supports the following fields:
- host: The database server hostname or IP address
- port: The database server port (typically 5432)
- database: The name of the database to connect to
- username: The database user for authentication
- description (optional): A human-readable description of the connection
The default_connection value determines which connection is used when no connection name is explicitly provided. It defaults to dev if not set.
Using PostgreSQL with ask
Once connections are configured, you can query them using the ask command with the --postgres flag:
clanker ask --postgres dev "show me the schema of the users table"
clanker ask --postgres stage "what are the largest tables by row count?"See Also
- Configuration -- Setting up the clanker configuration file
- Config File Reference -- Full reference for
~/.clanker.yaml - ask -- Querying infrastructure with natural language