get_query_details

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

Get query details by query id

Returns the details of a single query. The caller must be the user who submitted the query, otherwise the request is rejected with AUTH-1010. For executions that are not yet in a terminal state the status is refreshed against the live Athena or Redshift engine before it is returned, so the response can differ from the last stored value. Note that an unknown query id is reported as HTTP 400 with IPV-1002, not 404.

Parameters:
  • queryid (str) – Identifier of the query, as returned by POST /queries. (required)

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

  • projection_expression (str) – Comma-separated list of attributes to return. Applies to Athena queries only: the Redshift code paths ignore it and always return the full record. Use with care, because omitting attributes the handler relies on internally (QueryString, QueryStatus, Message, WorkGroup) causes the request to fail with HTTP 500 on CREATE statements.

  • _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:

QueryResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: GET /queries/{queryid}

Parameter examples

Name

In

Example

queryid

path

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

role_id

header

"role-admin"

projectionExpression

query

"QueryId,QueryStatus,ResultsDownloadLink"

Success (HTTP 200)

Query details, refreshed against the live engine where applicable.

Completed Athena query with a downloadable result set

{
  "QueryId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f",
  "QueryString": "SELECT * FROM sales.monthly_orders LIMIT 100",
  "QueryStatus": "SUCCEEDED",
  "QueryTargetLocation": "athena",
  "WorkGroup": "primary",
  "UserId": "user1",
  "CreatedBy": "user1",
  "CreationTime": "2025-01-15T10:30:00Z",
  "LastModifiedTime": "2025-01-15T10:30:12Z",
  "WorkbookId": "N/A",
  "QuerySource": "API",
  "ResultsDownloadLink": "https://s3.amazonaws.com/bucket/results/query.csv?X-Amz-Signature=..."
}

CREATE statement, which returns a message instead of a result set

{
  "QueryId": "e4b9f5d3-3c4d-4f01-9b5c-4d5e6f708192",
  "QueryString": "CREATE TABLE sales.summary AS SELECT * FROM sales.monthly_orders",
  "QueryStatus": "SUCCEEDED",
  "QueryTargetLocation": "athena",
  "WorkGroup": "primary",
  "UserId": "user1",
  "CreationTime": "2025-01-15T11:00:00Z",
  "LastModifiedTime": "2025-01-15T11:00:30Z",
  "Message": "Table created successfully"
}

Failed Redshift query

{
  "QueryId": "c2f7d3b1-1a2b-4d8e-9f3a-2b3c4d5e6f70",
  "QueryString": "SELECT * FROM public.missing_table",
  "QueryStatus": "FAILED",
  "QueryTargetLocation": "redshift",
  "UserId": "user1",
  "CreationTime": "2025-01-15T10:32:00Z",
  "LastModifiedTime": "2025-01-15T10:32:05Z",
  "Message": "relation \"public.missing_table\" does not exist"
}

Errors

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

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), AUTH-1001 / AUTH-1030 / GE-1060 (authorization).

Unknown query id

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

Query belongs to another user

{
  "Message": "AUTH-1010 - User is not authorized to perform this operation"
}

HTTP 500

Backend or generic failure. Body is {“Message”: “<CODE> - <text>”}.

Request / response example

{
  "Message": "RTE-1001 - <exception details>"
}