exportQuery
Execute a read-only SELECT SQL query and stream results to a CSV or JSON file. Supports large datasets with no row limit.
Instructions
Execute a read-only SELECT SQL query and stream the results to a file. Supports CSV and JSON output formats. Designed for large datasets – results are streamed directly to disk without a row-count limit. CSV options: delimiter (default ','), nullValue (default ''), bom (default false). JSON options: pretty (default false). Timeout is controlled by the EXPORT_QUERY_TIMEOUT environment variable (default: 300 s).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SELECT SQL statement whose results should be exported | |
| format | No | Output format. "csv" (default) or "json" | |
| options | No | Format-specific options. CSV: delimiter (default ","), nullValue (default ""), bom (default false). JSON: pretty (default false). Additional keys are accepted for forward compatibility. | |
| filepath | Yes | Destination file path (absolute, or relative to the server working directory) |