Query a data file with SQL
sql_queryRun read-only SQL SELECT queries on local CSV, Parquet, Excel, or JSON files, returning results as a Markdown table while ensuring the file is never modified.
Instructions
Run a read-only SQL SELECT over a local data file and get a Markdown table back. Supports: SELECT * | | aggregates COUNT/SUM/AVG/MIN/MAX, WHERE (=, !=, >, >=, <, <=, LIKE, IN) with AND, GROUP BY, ORDER BY [ASC|DESC], LIMIT, OFFSET. The table name in FROM is ignored (single-table). No writes, no arbitrary SQL execution — the query string is compiled to a safe read-only plan (no eval), and the file is never modified.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single SELECT statement, e.g. `SELECT species, AVG(body_mass_g) AS avg_mass FROM t GROUP BY species ORDER BY avg_mass DESC LIMIT 5`. Column names must match the file's headers. | |
| path | Yes | Path to the data file. |