Graphrt

PostgreSQL

Query berparameter di transaksi hanya baca yang ditegakkan database, dengan timeout dan batas baris serta byte. Penulisan dan DDL (lewat node, atau agent yang diizinkan), tabel, kolom dan query plan

Stabil v0.1.0 Node.js 5 aksi
Pakai di Graphrt Desktop

Tentang

Plugin Graphrt yang menjalankan SQL berparameter di PostgreSQL dengan driver pg. Secara default agent hanya punya akses baca. Query jalan di dalam transaksi READ ONLY yang selalu di-rollback, jadi database sendiri yang menolak penulisan.

Yang bisa dilakukan

  • query: one parameterised statement ($1, $2, ...) in a read-only transaction. Returns rows (objects), fields (name and type), row_count and truncated.
  • execute: one INSERT/UPDATE/DELETE/DDL statement, committed. Returns command, affected_rows and any RETURNING rows. Workflow nodes only, unless POSTGRES_TOOL_ALLOW_WRITES=1.
  • explain: EXPLAIN (text or JSON, optionally ANALYZE) in a read-only transaction.
  • list_tables and describe_table: tables and views, columns (type, nullable, default, comment), primary key, indexes and foreign keys.
  • Every operation is a node postgres.<operation> and an agent tool. The full reference is in OPERATIONS.md.

Aksi

Setiap aksi adalah langkah yang bisa ditambahkan ke workflow. Agent juga bisa memakai sebagian besar aksi sebagai tool.

  • Run a read-only query postgres.query
  • Run a write or DDL statement postgres.execute
  • Explain a query plan postgres.explain
  • List tables postgres.list_tables
  • Describe a table postgres.describe_table

Pengaturan

Graphrt menyalakan plugin dengan environment yang bersih. Hanya nilai ini yang sampai ke plugin, dan secret tidak masuk log.

  • POSTGRES_URL (none)
    Connection URL, e.g. postgres://app:secret@db.example.com:5432/shop?sslmode=verify-full. Percent-encode special characters in the password.
  • POSTGRES_HOST Port 5432
    Used when POSTGRES_URL is unset. POSTGRES_HOST may also be a Unix socket directory.
  • POSTGRES_SSLMODE Disable
    With the separate parts: disable, require (TLS without certificate checks) or verify-full. With a URL, put sslmode in the URL.
  • POSTGRES_STATEMENT_TIMEOUT_MS 30000
    Default statement timeout (100 to 600000). Nodes may pass any statement_timeout_ms, for agent tool calls this value is also the ceiling.
  • POSTGRES_CONNECT_TIMEOUT_MS 10000
    Connect timeout
  • POSTGRES_MAX_RESULT_BYTES 1000000
    Most JSON bytes of returned rows per call (1000 to 8000000)
  • POSTGRES_POOL_MAX 4
    Connections per pool
  • POSTGRES_TOOL_ALLOW_WRITES (off)
    1 lets agents call execute. Leave it off unless the role itself is limited.
  • POSTGRES_ALLOW_SUPERUSER (off)
    1 lets agent tool calls run on a superuser connection (refused by default, see Safety)
  • POSTGRES_PORT
  • POSTGRES_USER
  • POSTGRES_PASSWORD
  • POSTGRES_DATABASE

Cara memakainya

Di Graphrt Desktop

  1. Buka Plugins dan cari PostgreSQL.
  2. Klik Install lalu setujui.
  3. Ikuti langkah setup di halaman plugin, lalu tempel pengaturan yang dibutuhkan.
  4. Jelaskan pekerjaan yang membutuhkannya, dan builder menambahkan langkahnya.
Plugin di Graphrt Desktop

Dengan CLI

terminal
$ graphrt plugin install postgres
workflow.yaml
- id: orders
  type: postgres.query
  sql: "SELECT id, total, created_at FROM orders WHERE customer_id = $1 AND created_at >= $2 ORDER BY created_at DESC"
  params: ["{{#start.customer_id#}}", "2026-11-01"]
  max_rows: 50
- id: mark
  type: postgres.execute
  sql: "UPDATE orders SET status = $1 WHERE id = $2 RETURNING id, status"
  params: ["shipped", "{{#orders.data.rows.0.id#}}"]
Plugin di docs