# Trino

> Query and execute Trino or Iceberg SQL through a JSON CLI. Use when the user explicitly asks to inspect Trino/Iceberg or run a confirmed DDL, DML, or administrative statement. Access is limited by the configured Trino account and catalog grants.

- Skill: `bgevorkian/trino` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add bgevorkian/trino`
- Raw SKILL.md: https://api.skillmd.com/api/skills/bgevorkian/trino/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- License: MIT
- Author: bgevorkian (https://skillmd.com/u/bgevorkian)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/bgevorkian/trino

---


# Trino

Generic Trino JSON CLI. Read commands use guarded SQL; `exec` runs one statement allowed by the configured Trino account.

## Local `.env`

The CLI automatically loads a private `.env` beside this `SKILL.md` through `pass-cli`. Copy `.env.example` to `.env` and replace placeholders with environment values or secret-manager pointers.

| Variable | Flag | Default |
|---|---|---|
| `TRINO_HOST` | `--host` | none |
| `TRINO_PORT` | `--port` | `443` for HTTPS, otherwise `8080` |
| `TRINO_USER` | `--user` | none |
| `TRINO_CATALOG` | `--catalog` | none |
| `TRINO_SCHEMA` | `--schema` | none |
| `TRINO_HTTP_SCHEME` | `--http-scheme` | `https` |
| `TRINO_PASSWORD` | none | empty |
| `TRINO_ACCESS_TOKEN` | none | empty |
| `TRINO_CERT` / `TRINO_KEY` | none | empty |
| `TRINO_VERIFY` | `--verify` / `--no-verify` | `true` |

Never pass secrets as CLI arguments or commit a real `.env`.

## Read

```bash
uv run --python 3.13 --with trino python scripts/tr.py query --sql "SELECT current_catalog, current_schema"
uv run --python 3.13 --with trino python scripts/tr.py list-catalogs
uv run --python 3.13 --with trino python scripts/tr.py list-schemas --catalog iceberg
uv run --python 3.13 --with trino python scripts/tr.py list-tables --catalog iceberg --schema analytics
uv run --python 3.13 --with trino python scripts/tr.py describe-table --catalog iceberg --schema analytics --table events
```

Read commands reject obvious mutations, enforce one statement, cap rows, and use request timeouts.

## Execute

Use `exec` only after the user approves the exact operation and target:

```bash
uv run --python 3.13 --with trino python scripts/tr.py \
  --catalog iceberg --schema analytics \
  exec --sql "ALTER TABLE events ADD COLUMN source varchar"
```

`exec` accepts one DDL, DML, or administrative statement. It rejects empty and multi-statement SQL. There is no local write authorization gate: Trino account and catalog grants are the authorization boundary.

## Safety contract

- Obtain fresh user approval before each mutation scope.
- Read commands retain local SQL guards, timeouts, TLS verification, and result limits.
- `exec` rejects empty and multi-statement SQL; the configured account decides what is allowed.
- Do not print secrets, tokens, certificates, `.env` contents, or environment variables.
- Ask before touching sensitive data.

## Output

```json
{
  "rows": [{"catalog": "iceberg"}],
  "row_count": 1
}
```

Execution returns `{"ok": true}` and returned rows when available.

## Tests

```bash
uv run --python 3.13 --with trino python tests/test_tr.py
```

