# Turquoisehealth Pricepoints Trino

> Trino Query Skill

- Skill: `tomevault-io/turquoisehealth-pricepoints-trino` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/turquoisehealth-pricepoints-trino`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/turquoisehealth-pricepoints-trino/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/turquoisehealth-pricepoints-trino

---


# Trino Query Skill

## Critical Rules

- **Read-only**, NEVER run DDL/DML (`INSERT`, `UPDATE`, `DELETE`, `DROP`, `CREATE`, `ALTER`)
- **Always LIMIT** exploratory queries (start with `LIMIT 100`)
- **Always use `--file`**, never `--execute`, for multi-line queries
- **Use Trino SQL dialect**: uppercase keywords, double-quoted identifiers, ANSI syntax

## Workflow

1. Write SQL to a file using Claude Write() and Edit() capabilities. Write to the `queries/tmp` directory of a project
2. Execute the queries with:

    ```bash
    trino --file queries/tmp/query_name.sql
    ```

3. Inspect results, refine query, re-run if necessary
4. Run independent queries in parallel using background Bash tasks

## Performance

- Avoid `SELECT COUNT(*) FROM table` on large tables - very slow without filters
- Avoid `SELECT *` - select only the columns you need
- Always apply `WHERE` filters to narrow scans before aggregating
- Use `LIMIT` for exploratory queries
- When filtering on partitioned columns (e.g. `year`, `month`), include them in `WHERE` to enable partition pruning

## Table Discovery

Use these commands to explore the database:

```sql
SHOW SCHEMAS FROM tq_production;
SHOW TABLES FROM tq_production.<schema>;
DESCRIBE tq_production.<schema>.<table>;
SHOW COLUMNS FROM tq_production.<schema>.<table>;
```

## Error Handling

| Error | Fix |
|---|---|
| `COLUMN_NOT_FOUND` | Run `SHOW COLUMNS FROM <table>` to check exact column names |
| `TABLE_NOT_FOUND` | Run `SHOW TABLES FROM <schema>` to verify table exists |
| Type mismatch (e.g. `varchar` vs `integer`) | Use `CAST(col AS type)` to align types |
| Query timeout | Add `WHERE` filters, reduce scope, or add `LIMIT` |
| `SCHEMA_NOT_FOUND` for payer data | Check the year/month — use `SHOW SCHEMAS FROM tq_production` to find available months |

## Available Tables

List of most important tables/schemas, not exhaustive. Only reference if necessary:

- **Clear Rates** (cleaned, validated price data): See [references/clear-rates.md](references/clear-rates.md)
- **Hospital Price Transparency** (hospital MRF price data): See [references/hospital.md](references/hospital.md)
- **Payer Data** (payer Transparency in Coverage price data): See [references/payer.md](references/payer.md)
- **Spines** (reference data): See [references/spines.md](references/spines.md)
- **Claims Benchmarks** (anonymized utilization, gross price data): See [references/claims.md](references/claims.md)

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/turquoisehealth) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

