Trino CLI
$ trino 基金会 中风险Trino CLI(trino)连接 Trino Coordinator,对 Iceberg、Hive、PostgreSQL、Kafka 和 S3 等数据湖执行联邦 SQL 查询。批处理参数 --execute 配合 --output-format JSON 或 CSV 可向标准输出稳定返回结果。
brew install trino trino 可直接对 Coordinator HTTP 端点执行本地 SQL 文件(-f)或内联查询(--execute)并输出 --output-format JSON。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
批处理模式原生支持 --execute、-f 与 --output-format JSON / CSV / TSV,但每次调用均存在 JVM 启动开销。
--executeand--output-format JSONemit machine-readable rows
支持 TRINO_PASSWORD、--access-token、TLS 证书库及 SQL EXPLAIN,但无 CLI 级 --read-only 参数。
- Env-var password and token auth; relies on coordinator RBAC for read-only enforcement
以可执行 JAR 形式通过 Homebrew(brew install trino)分发,宿主需安装高版本 Java / JVM。
- Packaged via Homebrew and Maven Central JAR; requires JVM
用统一的 ANSI SQL 接口跨 Iceberg、Postgres、S3、Kafka 等异构数据源查询。
- Federated SQL across multiple catalogs via
--catalogand--schema
由 Trino 软件基金会维护(trinodb/trino),采用 Apache-2.0 协议。
- Official
trinodb/trinorepository under Apache-2.0
trino.io/docs/current/client/cli.html 对参数与输出格式说明清晰。
- Official CLI guide at trino.io
安全边界、鉴权与放权指南
支持搭配 --password 使用 TRINO_PASSWORD 环境变量,并支持 --access-token 与 --truststore-path 等 TLS 认证参数。
Apache-2.0 开源 CLI 免费;查询云端托管 Starburst/Trino 集群或对象存储扫描会产生计算与流量费用。
# Trino CLI (trino) Agent Rules - Always pass `--execute` (or `-f`) and `--output-format JSON` (or `CSV`) to avoid the interactive shell. - Inspect partitions and run `EXPLAIN` or `LIMIT` before scanning large data-lake tables. - Pass passwords via `TRINO_PASSWORD` or `--access-token` rather than inline flags.
Agent 高频安全命令配方
只读查询(安全推荐)
trino --server http://localhost:8080 --execute "SHOW CATALOGS" --output-format JSON
在批处理模式下查询可用数据源 Catalog 并输出 JSON。
trino --server http://localhost:8080 --catalog iceberg --schema analytics --execute "DESCRIBE events" --output-format JSON
在编写分析 SQL 前先以 JSON 获取表字段元数据。
核心优势
- +
--execute与--output-format JSON组合非常适合无头联邦 SQL 执行。 - + 支持
--access-token与TRINO_PASSWORD实现非交互认证。
注意事项与踩坑点
- ! 强依赖现代 JVM 运行时,单次命令启动延迟较明显。
- ! 缺少客户端
--read-only标志,只读约束依赖 Coordinator 侧权限控制。