get_query_result_download_url

PlaygroundApi.get_query_result_download_url(queryid, role_id, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Get a download URL for the full query results

Returns a time-limited presigned URL for the complete result file of a query, without the 51-row cap applied by GET /queries/{queryid}/results. The query must have reached SUCCEEDED and the caller must be the user who submitted it. Not supported for statements that produce no result set: CREATE, MERGE INTO and VACUUM queries are rejected with GE-1034. Note that an unknown query id is reported as HTTP 400 with IPV-1002, not 404.

Parameters:
  • queryid (str) – Identifier of the query whose result file is being downloaded. (required)

  • role_id (str) – Amorphic role ID the request is authorized against. Must be a role the caller belongs to. (required)

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

QueryResultsDownloadResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: GET /queries/{queryid}/results/download

Parameter examples

Name

In

Example

queryid

path

"b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f"

role_id

header

"role-admin"

Success (HTTP 200)

Presigned download URL for the complete result file. The URL is time-limited and should be used promptly.

Request / response example

{
  "url": "https://s3.amazonaws.com/bucket/results/b1e6c2a0.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600&X-Amz-Signature=..."
}

Errors

Documented error codes: IPV-1002, AUTH-1010, GE-1095, GE-1034, AUTH-1001, AUTH-1030, GE-1060.

HTTP 400

Input validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: IPV-1002 (query id not found), AUTH-1010 (the query belongs to a different user), GE-1095 (the query has not reached SUCCEEDED, or has no stored result file), GE-1034 (download is not supported for CREATE, MERGE INTO and VACUUM queries), AUTH-1001 / AUTH-1030 / GE-1060 (authorization).

Query has not finished successfully, or has no result file

{
  "Message": "GE-1095 - No query results available for download. Please try again after some time."
}

Download requested for a statement with no result set

{
  "Message": "GE-1034 - Results download operation is not supported for CREATE, MERGE INTO and VACUUM queries"
}

Unknown query id

{
  "Message": "IPV-1002 - Invalid QueryId - b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f, resource not found."
}

HTTP 500

Something went wrong at backend