/trino-query
Run a Trino SQL query and return the results.
Usage
/trino-query <SQL query or description>
Provide either a literal SQL query or a description of what you want to run. If you provide a description, the skill will compose the appropriate SQL.
Prerequisites
-
Copy
.env.exampleto.envand fill in your Trino credentials:TRINO_HOST=...
TRINO_USERNAME=...
TRINO_PASSWORD=...
TRINO_PORT=... -
Install dependencies:
poetry install(creates the.venv/withpandas,tqds, andpython-dotenv).
What It Does
- Loads environment — reads Trino credentials from
.envand verifies all four variables are set. - Verifies the Poetry venv — checks that
.venv/exists (prompts you to runpoetry installif not). - Runs the query — executes the SQL via
tqds.sql.db.TrinoClientand loads results into a pandas DataFrame. Displays up to 50 rows; if more, shows the first 50 with a count of omitted rows. - Reports errors — if the query fails, shows the error and stops.
Common Tables
| Table | Partition |
|---|---|
tq_production.clear_rates_{yyyy_mm}.clear_rates | payer_id |
tq_production.public_{yyyy_mm}.core_rates | payer_id |
tq_production.hospital_data.hospital_rates | provider_id |
tq_production.spines.* | varies |
tq_dev.internal_dev_csong_cld_{version}.* | varies |