AgentSkillsCN

postgres

查询并管理PostgreSQL数据库——运行SQL、检查表结构、加载数据,以及管理连接。

SKILL.md
--- frontmatter
name: postgres
description: >
  Query and manage PostgreSQL databases — run SQL, inspect schemas,
  load data, and manage connections.
metadata:
  openclaw:
    requires:
      bins: [clawdata]
    primaryEnv: POSTGRES_CONNECTION_STRING
    tags: [database, postgres, postgresql, sql, query]

PostgreSQL

Query and manage PostgreSQL databases through the ClawData adapter.

Commands

TaskCommand
Connectclawdata connect add pg --type postgres --connection-string postgresql://...
Queryclawdata db query "SELECT ..." --profile pg
List tablesclawdata db tables --profile pg
Schemaclawdata db schema <table> --profile pg
Exportclawdata db export "SELECT ..." --profile pg -o data.csv

Connection

bash
# Add a Postgres connection profile
clawdata connect add prod-pg \
  --type postgres \
  --connection-string "postgresql://user:pass@host:5432/dbname"

# Use it
clawdata db tables --profile prod-pg

When to use

  • User asks to query a Postgres database → use --profile flag with postgres connection
  • User wants to move data from Postgres to DuckDB → query + export + ingest
  • User needs to inspect a remote database schema → clawdata db schema --profile

Cross-database Workflows

bash
# Export from Postgres
clawdata db export "SELECT * FROM users" --profile pg -o users.csv

# Load into DuckDB
clawdata data ingest users.csv users