query_file
Execute SQL queries on local Parquet, CSV, or JSON files by treating them as tables, enabling instant data analysis without a separate database.
Instructions
Query a local file (Parquet/CSV/JSON/…) as if it were a table.
The literal token {file} in sql is substituted with a
file('path', 'format') table-function call before execution.
Example::
query_file(
path="/data/sales.parquet",
sql="SELECT region, sum(revenue) FROM {file} GROUP BY region",
format="Parquet",
)Args:
path: Filesystem path. If CHDB_MCP_FILE_ALLOWLIST is set, the
resolved path must sit under one of its prefixes.
sql: Query body. Must contain the literal placeholder {file}.
When CHDB_MCP_FILE_ALLOWLIST is set, the SQL is scanned
before substitution; any extra table function call other than
the placeholder (e.g. a UNION with file('/etc/passwd', ...)
or a stray url()/executable()) is rejected.
format: chDB file format hint. Common values: Parquet, CSV,
CSVWithNames, JSONEachRow, Arrow.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| sql | Yes | ||
| format | No | Parquet |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |