Query stored results
results_queryRun read-only SQL SELECT queries over session results in DuckDB, using result_ids as tables to join, filter, aggregate, or window market data.
Instructions
Run ONE read-only SQL SELECT (DuckDB dialect; WITH, joins, window functions, ASOF JOIN and time_bucket allowed) over results stored in this session, using each result_id as a table name. Returns at most max_rows rows (default 50, at most 200; a larger LIMIT is lowered). Larger answers, or store=true, are kept as a new result and you get its result_id. Files, settings, other sessions and every write are refused.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | One read-only SELECT (or WITH ... SELECT) over this session's results; use each result_id as a table name, e.g. SELECT ticker, max(close) FROM r_8c1f0a9d3e GROUP BY ticker. | |
| store | No | Keep the full answer (up to fetch.max_rows rows) as a new result and return its marker. | |
| max_rows | No | Rows to return (1-200). A LIMIT above it is lowered. |