Export query
export_queryRun a read-only SQL query and export the results as CSV or JSON. Supports pagination with configurable row limits.
Instructions
Run a read-only SQL query and serialise its rows to CSV or JSON. Reuses the SQL-safety checks of run_select. Truncates at limit rows and flags it in the result so callers can paginate.
Example: export_query(sql='SELECT id, email FROM users', format='csv', limit=10000)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| limit | No | ||
| format | No | csv | |
| database | No | Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | Yes | ||
| content | Yes | ||
| row_count | Yes | ||
| truncated | Yes |