Get SQL Query Chunks

Use the GET /api/v3/query/{queryId}/chunks/{chunkId} endpoint of the Data 360 Query API to retrieve a specific result chunk from a completed query. Use the chunkCount field from the query status response to determine the available chunk IDs. Results are streamed and available in JSON or Apache Arrow format.

Syntax 

  • HTTP Method: GET
  • Format: REST
  • URI: /api/v3/query/{queryId}/chunks/{chunkId}

Path Parameters 

ParameterTypeDescription
queryIdstringRequired. The unique identifier of the query returned from POST /api/v3/query. Example: MTAuMjcuMTgxLjE0OTo3NDg0_1cfc8d35.
chunkIdintegerRequired. The chunk index to retrieve. The index starts at 0. Use chunkCount from the query status response to determine the total number of available chunks.

Query Parameters 

ParameterRequiredTypeDescription
omitSchemaNobooleantrue to omit schema metadata from the response. Default false.

Request Headers 

HeaderValue
AuthorizationBearer {accessToken}
Acceptapplication/json or application/vnd.apache.arrow.stream

Response Structure 

Results are streamed using Transfer-Encoding: chunked.

FieldDescription
metadataObject containing column schema. Not included when omitSchema=true.
dataArray of result rows, where each row is an array of values ordered by the metadata.columns schema.
returnedRowsNumber of rows returned in this chunk. Arrow responses omit this field.

Apache Arrow Response 

Set Accept: application/vnd.apache.arrow.stream to receive the chunk as a binary Arrow IPC stream instead of JSON. Arrow is recommended for large chunks.

Examples 

This example shows a chunk retrieval request and response.

Request 

1GET https://{dne_cdpInstanceUrl}/api/v3/query/MTAuMzAuNTkuMTA4Ojc0ODQ_c3161a23-1803-c0a0-ce4a-9d5bc19deddc/chunks/1
2Authorization: Bearer {accessToken}

Response 

1{
2  "metadata": {
3    "columns": [
4      { "name": "id__c", "type": "varchar", "nullable": false },
5      { "name": "name__c", "type": "varchar", "nullable": true }
6    ]
7  },
8  "data": [["c1ce2a48-9d03-4eed-938d-f354db79c425", "Gowtham"]],
9  "returnedRows": 1
10}

Related Resources