MATIH Platform is in active MVP development. Documentation reflects current implementation status.
9. Query Engine & SQL
Export Endpoints

Export Endpoints

The export endpoints allow query results to be exported in CSV, JSON, JSON Lines, and Parquet formats. Both synchronous and asynchronous export modes are supported. Served by QueryExportController at /v1/queries.


Endpoints

MethodEndpointDescription
POST/v1/queries/:executionId/exportExport synchronously
POST/v1/queries/:executionId/export/asyncExport asynchronously
GET/v1/queries/exports/:exportId/progressGet export progress
GET/v1/queries/exports/:exportId/downloadDownload export file
DELETE/v1/queries/exports/:exportIdClean up export

Export Formats

FormatContent TypeUse Case
CSVtext/csvSpreadsheet import, data exchange
JSONapplication/jsonAPI integration, structured data
JSON_LINESapplication/jsonStreaming processing, line-by-line parsing
PARQUETapplication/octet-streamAnalytics tools, columnar storage

POST /v1/queries/:executionId/export

Exports query results synchronously. Best for small to medium result sets.

{
  "format": "CSV",
  "includeHeaders": true,
  "compression": "GZIP",
  "maxRows": 100000
}

Asynchronous Export

For large result sets, use the async endpoint:

POST /v1/queries/:executionId/export/async

Returns 202 Accepted with an export ID. Poll the progress endpoint until status is COMPLETED:

GET /v1/queries/exports/:exportId/progress
{
  "executionId": "uuid",
  "status": "COMPLETED",
  "format": "PARQUET",
  "fileName": "export-uuid.parquet",
  "fileSize": 1048576,
  "rowCount": 50000
}

Downloading Results

GET /v1/queries/exports/:exportId/download

Returns the file as a binary download with appropriate Content-Type and Content-Disposition headers. The export must be in COMPLETED status.


Cleanup

DELETE /v1/queries/exports/:exportId

Removes the export file from storage and deletes the metadata record. Export files are also cleaned up automatically after a configurable retention period.