Skip to content

aws.athena.get_query_results

Example SQL Queries

SELECT * FROM
aws.athena.get_query_results
WHERE
"query_execution_id" = 'VALUE';

Description

Streams the results of a single query execution specified by QueryExecutionId from the Athena query results location in Amazon S3. For more information, see Working with query results, recent queries, and output files in the Amazon Athena User Guide. This request does not execute the query but returns results. Use StartQueryExecution to run a query.

To stream query results successfully, the IAM principal with permission to call GetQueryResults also must have permissions to the Amazon S3 GetObject action for the Athena query results location.

IAM principals with permission to the Amazon S3 GetObject action for the query results location are able to retrieve query results from Amazon S3 even if permission to the GetQueryResults action is denied. To restrict user or role access, ensure that Amazon S3 permissions to the Athena query location are denied.

Table Definition

Column NameColumn Data Type
query_execution_id Required Input Column

The unique ID of the query execution.

VARCHAR
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
result_set

The results of the query execution.

STRUCT(
"rows" STRUCT(
"data" STRUCT(
"var_char_value" VARCHAR
)[]
)[],
"result_set_metadata" STRUCT(
"column_info" STRUCT(
"catalog_name" VARCHAR,
"schema_name" VARCHAR,
"table_name" VARCHAR,
"name" VARCHAR,
"label" VARCHAR,
"type" VARCHAR,
"precision" BIGINT,
"scale" BIGINT,
"nullable" VARCHAR,
"case_sensitive" BOOLEAN
)[]
)
)
Show child fields
result_set.result_set_metadata

The metadata that describes the column structure and data types of a table of query results.

Show child fields
result_set.result_set_metadata.column_info[]
Show child fields
result_set.result_set_metadata.column_info[].case_sensitive

Indicates whether values in the column are case-sensitive.

result_set.result_set_metadata.column_info[].catalog_name

The catalog to which the query results belong.

result_set.result_set_metadata.column_info[].label

A column label.

result_set.result_set_metadata.column_info[].name

The name of the column.

result_set.result_set_metadata.column_info[].nullable

Unsupported constraint. This value always shows as UNKNOWN.

result_set.result_set_metadata.column_info[].precision

For DECIMAL data types, specifies the total number of digits, up to 38. For performance reasons, we recommend up to 18 digits.

result_set.result_set_metadata.column_info[].scale

For DECIMAL data types, specifies the total number of digits in the fractional part of the value. Defaults to 0.

result_set.result_set_metadata.column_info[].schema_name

The schema name (database name) to which the query results belong.

result_set.result_set_metadata.column_info[].table_name

The table name for the query results.

result_set.result_set_metadata.column_info[].type

The data type of the column.

result_set.rows[]
Show child fields
result_set.rows[].data[]
Show child fields
result_set.rows[].data[].var_char_value

The value of the datum.

update_count

The number of rows inserted with a CREATE TABLE AS SELECT statement.

BIGINT