query
Execute SQL queries against the in-process chDB OLAP engine to analyze data from Parquet, CSV, JSON, and pandas DataFrames. Returns results in multiple formats with configurable limits.
Instructions
Execute an arbitrary SQL statement against the chDB session.
Use ClickHouse SQL dialect. Common formats: JSONCompact (default),
CSVWithNames, TabSeparatedWithNames, Pretty. The result is
truncated at CHDB_MCP_MAX_RESULT_BYTES (default 1 MiB) and the query
is aborted after CHDB_MCP_QUERY_TIMEOUT_SEC seconds (default 30).
Args:
sql: Any read-only SQL (SELECT/SHOW/DESCRIBE/EXPLAIN). Writes require
CHDB_MCP_WRITE=1. When CHDB_MCP_FILE_ALLOWLIST is set,
any table function that isn't on the safe-by-construction list
(numbers/values/view/merge/dictionary/etc.) is rejected — that
includes file/url/s3/remote/executable/python and every other
external-reach function chDB exposes. Use query_file() for
files instead.
format: Output format passed to chDB. Defaults to JSONCompact.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| format | No | JSONCompact |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |