Table of Contents
Athena.Client¶A low-level client representing Amazon Athena:
client = session.create_client('athena')
These are the available methods:
batch_get_named_query()batch_get_query_execution()can_paginate()create_named_query()delete_named_query()generate_presigned_url()get_named_query()get_paginator()get_query_execution()get_query_results()get_waiter()list_named_queries()list_query_executions()start_query_execution()stop_query_execution()batch_get_named_query(**kwargs)¶Returns the details of a single named query or a list of up to 50 queries, which you provide as an array of query ID strings. Use ListNamedQueries to get the list of named query IDs. If information could not be retrieved for a submitted query ID, information about the query ID submitted is listed under UnprocessedNamedQueryId . Named queries are different from executed queries. Use BatchGetQueryExecution to get details about each unique query execution, and ListQueryExecutions to get a list of query execution IDs.
See also: AWS API Documentation
Request Syntax
response = client.batch_get_named_query(
NamedQueryIds=[
'string',
]
)
| Parameters: | NamedQueryIds (list) – [REQUIRED] An array of query IDs.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'NamedQueries': [
{
'Name': 'string',
'Description': 'string',
'Database': 'string',
'QueryString': 'string',
'NamedQueryId': 'string'
},
],
'UnprocessedNamedQueryIds': [
{
'NamedQueryId': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
|
batch_get_query_execution(**kwargs)¶Returns the details of a single query execution or a list of up to 50 query executions, which you provide as an array of query execution ID strings. To get a list of query execution IDs, use ListQueryExecutions . Query executions are different from named (saved) queries. Use BatchGetNamedQuery to get details about named queries.
See also: AWS API Documentation
Request Syntax
response = client.batch_get_query_execution(
QueryExecutionIds=[
'string',
]
)
| Parameters: | QueryExecutionIds (list) – [REQUIRED] An array of query execution IDs.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'QueryExecutions': [
{
'QueryExecutionId': 'string',
'Query': 'string',
'ResultConfiguration': {
'OutputLocation': 'string',
'EncryptionConfiguration': {
'EncryptionOption': 'SSE_S3'|'SSE_KMS'|'CSE_KMS',
'KmsKey': 'string'
}
},
'QueryExecutionContext': {
'Database': 'string'
},
'Status': {
'State': 'QUEUED'|'RUNNING'|'SUCCEEDED'|'FAILED'|'CANCELLED',
'StateChangeReason': 'string',
'SubmissionDateTime': datetime(2015, 1, 1),
'CompletionDateTime': datetime(2015, 1, 1)
},
'Statistics': {
'EngineExecutionTimeInMillis': 123,
'DataScannedInBytes': 123
}
},
],
'UnprocessedQueryExecutionIds': [
{
'QueryExecutionId': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
|
can_paginate(operation_name)¶Check if an operation can be paginated.
| Parameters: | operation_name (string) – The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo, and you’d normally invoke the
operation as client.create_foo(**kwargs), if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo"). |
|---|---|
| Returns: | True if the operation can be paginated,
False otherwise. |
create_named_query(**kwargs)¶Creates a named query.
For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide .
See also: AWS API Documentation
Request Syntax
response = client.create_named_query(
Name='string',
Description='string',
Database='string',
QueryString='string',
ClientRequestToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'NamedQueryId': 'string'
}
Response Structure
|
delete_named_query(**kwargs)¶Deletes a named query.
For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide .
See also: AWS API Documentation
Request Syntax
response = client.delete_named_query(
NamedQueryId='string'
)
| Parameters: | NamedQueryId (string) – [REQUIRED] The unique ID of the query to delete. This field is autopopulated if not provided. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{}
Response Structure
|
generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)¶Generate a presigned url given a client, its method, and arguments
| Parameters: |
|
|---|---|
| Returns: | The presigned url |
get_named_query(**kwargs)¶Returns information about a single query.
See also: AWS API Documentation
Request Syntax
response = client.get_named_query(
NamedQueryId='string'
)
| Parameters: | NamedQueryId (string) – [REQUIRED] The unique ID of the query. Use ListNamedQueries to get query IDs. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'NamedQuery': {
'Name': 'string',
'Description': 'string',
'Database': 'string',
'QueryString': 'string',
'NamedQueryId': 'string'
}
}
Response Structure
|
get_paginator(operation_name)¶Create a paginator for an operation.
| Parameters: | operation_name (string) – The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo, and you’d normally invoke the
operation as client.create_foo(**kwargs), if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo"). |
|---|---|
| Raises: | OperationNotPageableError – Raised if the operation is not
pageable. You can use the client.can_paginate method to
check if an operation is pageable. |
| Return type: | L{botocore.paginate.Paginator} |
| Returns: | A paginator object. |
get_query_execution(**kwargs)¶Returns information about a single execution of a query. Each time a query executes, information about the query execution is saved with a unique ID.
See also: AWS API Documentation
Request Syntax
response = client.get_query_execution(
QueryExecutionId='string'
)
| Parameters: | QueryExecutionId (string) – [REQUIRED] The unique ID of the query execution. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'QueryExecution': {
'QueryExecutionId': 'string',
'Query': 'string',
'ResultConfiguration': {
'OutputLocation': 'string',
'EncryptionConfiguration': {
'EncryptionOption': 'SSE_S3'|'SSE_KMS'|'CSE_KMS',
'KmsKey': 'string'
}
},
'QueryExecutionContext': {
'Database': 'string'
},
'Status': {
'State': 'QUEUED'|'RUNNING'|'SUCCEEDED'|'FAILED'|'CANCELLED',
'StateChangeReason': 'string',
'SubmissionDateTime': datetime(2015, 1, 1),
'CompletionDateTime': datetime(2015, 1, 1)
},
'Statistics': {
'EngineExecutionTimeInMillis': 123,
'DataScannedInBytes': 123
}
}
}
Response Structure
|
get_query_results(**kwargs)¶Returns the results of a single query execution specified by QueryExecutionId . This request does not execute the query but returns results. Use StartQueryExecution to run a query.
See also: AWS API Documentation
Request Syntax
response = client.get_query_results(
QueryExecutionId='string',
NextToken='string',
MaxResults=123
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'ResultSet': {
'Rows': [
{
'Data': [
{
'VarCharValue': 'string'
},
]
},
],
'ResultSetMetadata': {
'ColumnInfo': [
{
'CatalogName': 'string',
'SchemaName': 'string',
'TableName': 'string',
'Name': 'string',
'Label': 'string',
'Type': 'string',
'Precision': 123,
'Scale': 123,
'Nullable': 'NOT_NULL'|'NULLABLE'|'UNKNOWN',
'CaseSensitive': True|False
},
]
}
},
'NextToken': 'string'
}
Response Structure
|
get_waiter(waiter_name)¶list_named_queries(**kwargs)¶Provides a list of all available query IDs.
For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide .
See also: AWS API Documentation
Request Syntax
response = client.list_named_queries(
NextToken='string',
MaxResults=123
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'NamedQueryIds': [
'string',
],
'NextToken': 'string'
}
Response Structure
|
list_query_executions(**kwargs)¶Provides a list of all available query execution IDs.
For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide .
See also: AWS API Documentation
Request Syntax
response = client.list_query_executions(
NextToken='string',
MaxResults=123
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'QueryExecutionIds': [
'string',
],
'NextToken': 'string'
}
Response Structure
|
start_query_execution(**kwargs)¶Runs (executes) the SQL query statements contained in the Query string.
For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide .
See also: AWS API Documentation
Request Syntax
response = client.start_query_execution(
QueryString='string',
ClientRequestToken='string',
QueryExecutionContext={
'Database': 'string'
},
ResultConfiguration={
'OutputLocation': 'string',
'EncryptionConfiguration': {
'EncryptionOption': 'SSE_S3'|'SSE_KMS'|'CSE_KMS',
'KmsKey': 'string'
}
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'QueryExecutionId': 'string'
}
Response Structure
|
stop_query_execution(**kwargs)¶Stops a query execution.
For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide .
See also: AWS API Documentation
Request Syntax
response = client.stop_query_execution(
QueryExecutionId='string'
)
| Parameters: | QueryExecutionId (string) – [REQUIRED] The unique ID of the query execution to stop. This field is autopopulated if not provided. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{}
Response Structure
|
The available paginators are:
Athena.Paginator.GetQueryResultsAthena.Paginator.ListNamedQueriesAthena.Paginator.ListQueryExecutionsAthena.Paginator.GetQueryResults¶paginator = client.get_paginator('get_query_results')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from Athena.Client.get_query_results().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
QueryExecutionId='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'ResultSet': {
'Rows': [
{
'Data': [
{
'VarCharValue': 'string'
},
]
},
],
'ResultSetMetadata': {
'ColumnInfo': [
{
'CatalogName': 'string',
'SchemaName': 'string',
'TableName': 'string',
'Name': 'string',
'Label': 'string',
'Type': 'string',
'Precision': 123,
'Scale': 123,
'Nullable': 'NOT_NULL'|'NULLABLE'|'UNKNOWN',
'CaseSensitive': True|False
},
]
}
},
}
Response Structure
|
Athena.Paginator.ListNamedQueries¶paginator = client.get_paginator('list_named_queries')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from Athena.Client.list_named_queries().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
| Parameters: | PaginationConfig (dict) – A dictionary that provides parameters to control pagination.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'NamedQueryIds': [
'string',
],
}
Response Structure
|
Athena.Paginator.ListQueryExecutions¶paginator = client.get_paginator('list_query_executions')
paginate(**kwargs)¶Creates an iterator that will paginate through responses from Athena.Client.list_query_executions().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
| Parameters: | PaginationConfig (dict) – A dictionary that provides parameters to control pagination.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'QueryExecutionIds': [
'string',
],
}
Response Structure
|