get_query_results: Get Query Results

Description Usage Arguments Details Value Note References Examples

Description

Returns the results of a single query execution specified by query_execution_id. This request does not execute the query but returns results. Use start_query_execution() to run a query.

Usage

1
2
3
get_query_results(query_execution_id, chunk_size = 1000L,
  aws_access_key_id = NULL, aws_secret_access_key = NULL,
  aws_session_token = NULL, region_name = NULL, profile_name = NULL)

Arguments

query_execution_id

unique ID of the query execution.

chunk_size

the AWS Athena API returns the result set in batches. Smaller values for chunk_size mean more requests are made to retrieve the entire result set. Larger values for chunk_size will retrieve more data for each call but may not be as performant depending on many factors including network speed, AWS region, etc. Tune this if the default causes API failures for your situation. The maximum value (set by the AWS Athena API endpoint) is 1000.

aws_access_key_id

AWS access key id

aws_secret_access_key

AWS secret access key

aws_session_token

AWS session token

region_name

region name

profile_name

profile name

Details

While this function works, it may be faster to use the awscli utility to sync the cached CSV file and use your favorite R CSV reader. One advantage of this function is that it does know the column types (and sets them appropriately) but you also know what the column types are since you are querying a database you have access to. You should consider performing some real-world performance tests and choose the result set ingestion method that works best for you.

Value

data frame (tibble)

Note

This retrieves all the results (i.e. it handles pagination for you).

References

https://boto3.readthedocs.io/en/latest/reference/services/athena.html#Athena.Client.get_query_results

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
start_query_execution(
  query = "SELECT * FROM elb_logs LIMIT 100",
  database = "sampledb",
  output_location = "s3://aws-athena-query-results-redacted",
  profile = "personal"
) -> sqe

# wait a bit

get_query_results(sqe)

## End(Not run)

hrbrmstr/roto.athena documentation built on May 29, 2019, 11:42 a.m.