Table of Contents
A low-level client representing Amazon Athena
Amazon Athena is an interactive query service that lets you use standard SQL to analyze data directly in Amazon S3. You can point Athena at your data in Amazon S3 and run ad-hoc queries and get results in seconds. Athena is serverless, so there is no infrastructure to set up or manage. You pay only for the queries you run. Athena scales automatically—executing queries in parallel—so results are fast, even with large datasets and complex queries. For more information, see What is Amazon Athena in the Amazon Athena User Guide .
If you connect to Athena using the JDBC driver, use version 1.1.0 of the driver or later with the Amazon Athena API. Earlier version drivers do not support the API. For more information and to download the driver, see Accessing Amazon Athena with JDBC .
For code samples using the Amazon Web Services SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide .
import boto3
client = boto3.client('athena')
These are the available methods:
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. Requires you to have access to the workgroup in which the queries were saved. Use ListNamedQueriesInput to get the list of named query IDs in the specified workgroup. If information could not be retrieved for a submitted query ID, information about the query ID submitted is listed under UnprocessedNamedQueryId . Named queries differ from executed queries. Use BatchGetQueryExecutionInput to get details about each unique query execution, and ListQueryExecutionsInput to get a list of query execution IDs.
See also: AWS API Documentation
Request Syntax
response = client.batch_get_named_query(
NamedQueryIds=[
'string',
]
)
[REQUIRED]
An array of query IDs.
{
'NamedQueries': [
{
'Name': 'string',
'Description': 'string',
'Database': 'string',
'QueryString': 'string',
'NamedQueryId': 'string',
'WorkGroup': 'string'
},
],
'UnprocessedNamedQueryIds': [
{
'NamedQueryId': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
Information about the named query IDs submitted.
A query, where QueryString contains the SQL statements that make up the query.
The query name.
The query description.
The database to which the query belongs.
The SQL statements that make up the query.
The unique identifier of the query.
The name of the workgroup that contains the named query.
Information about provided query IDs.
Information about a named query ID that could not be processed.
The unique identifier of the named query.
The error code returned when the processing request for the named query failed, if applicable.
The error message returned when the processing request for the named query failed, if applicable.
Exceptions
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. Requires you to have access to the workgroup in which the queries ran. To get a list of query execution IDs, use ListQueryExecutionsInput$WorkGroup . Query executions differ from named (saved) queries. Use BatchGetNamedQueryInput to get details about named queries.
See also: AWS API Documentation
Request Syntax
response = client.batch_get_query_execution(
QueryExecutionIds=[
'string',
]
)
[REQUIRED]
An array of query execution IDs.
{
'QueryExecutions': [
{
'QueryExecutionId': 'string',
'Query': 'string',
'StatementType': 'DDL'|'DML'|'UTILITY',
'ResultConfiguration': {
'OutputLocation': 'string',
'EncryptionConfiguration': {
'EncryptionOption': 'SSE_S3'|'SSE_KMS'|'CSE_KMS',
'KmsKey': 'string'
},
'ExpectedBucketOwner': 'string',
'AclConfiguration': {
'S3AclOption': 'BUCKET_OWNER_FULL_CONTROL'
}
},
'QueryExecutionContext': {
'Database': 'string',
'Catalog': 'string'
},
'Status': {
'State': 'QUEUED'|'RUNNING'|'SUCCEEDED'|'FAILED'|'CANCELLED',
'StateChangeReason': 'string',
'SubmissionDateTime': datetime(2015, 1, 1),
'CompletionDateTime': datetime(2015, 1, 1),
'AthenaError': {
'ErrorCategory': 123,
'ErrorType': 123,
'Retryable': True|False,
'ErrorMessage': 'string'
}
},
'Statistics': {
'EngineExecutionTimeInMillis': 123,
'DataScannedInBytes': 123,
'DataManifestLocation': 'string',
'TotalExecutionTimeInMillis': 123,
'QueryQueueTimeInMillis': 123,
'QueryPlanningTimeInMillis': 123,
'ServiceProcessingTimeInMillis': 123
},
'WorkGroup': 'string',
'EngineVersion': {
'SelectedEngineVersion': 'string',
'EffectiveEngineVersion': 'string'
}
},
],
'UnprocessedQueryExecutionIds': [
{
'QueryExecutionId': 'string',
'ErrorCode': 'string',
'ErrorMessage': 'string'
},
]
}
Response Structure
Information about a query execution.
Information about a single instance of a query execution.
The unique identifier for each query execution.
The SQL query statements which the query execution ran.
The type of query statement that was run. DDL indicates DDL query statements. DML indicates DML (Data Manipulation Language) query statements, such as CREATE TABLE AS SELECT . UTILITY indicates query statements other than DDL and DML, such as SHOW CREATE TABLE , or DESCRIBE TABLE .
The location in Amazon S3 where query results were stored and the encryption option, if any, used for query results. These are known as "client-side settings". If workgroup settings override client-side settings, then the query uses the location for the query results and the encryption configuration that are specified for the workgroup.
The location in Amazon S3 where your query results are stored, such as s3://path/to/query/bucket/ . To run the query, you must specify the query results location using one of the ways: either for individual queries using either this setting (client-side), or in the workgroup, using WorkGroupConfiguration . If none of them is set, Athena issues an error that no output location is provided. For more information, see Query Results . If workgroup settings override client-side settings, then the query uses the settings specified for the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration .
If query results are encrypted in Amazon S3, indicates the encryption option used (for example, SSE_KMS or CSE_KMS ) and key information. This is a client-side setting. If workgroup settings override client-side settings, then the query uses the encryption configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE_S3 ), server-side encryption with KMS-managed keys (SSE_KMS ), or client-side encryption with KMS-managed keys (CSE_KMS ) is used.
If a query runs in a workgroup and the workgroup overrides client-side settings, then the workgroup's setting for encryption is used. It specifies whether query results must be encrypted, for all queries that run in this workgroup.
For SSE_KMS and CSE_KMS , this is the KMS key ARN or ID.
The Amazon Web Services account ID that you expect to be the owner of the Amazon S3 bucket specified by ResultConfiguration$OutputLocation . If set, Athena uses the value for ExpectedBucketOwner when it makes Amazon S3 calls to your specified output location. If the ExpectedBucketOwner Amazon Web Services account ID does not match the actual owner of the Amazon S3 bucket, the call fails with a permissions error.
This is a client-side setting. If workgroup settings override client-side settings, then the query uses the ExpectedBucketOwner setting that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
Indicates that an Amazon S3 canned ACL should be set to control ownership of stored query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . This is a client-side setting. If workgroup settings override client-side settings, then the query uses the ACL configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. For more information, see WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
The Amazon S3 canned ACL that Athena should specify when storing query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . If a query runs in a workgroup and the workgroup overrides client-side settings, then the Amazon S3 canned ACL specified in the workgroup's settings is used for all queries that run in the workgroup. For more information about Amazon S3 canned ACLs, see Canned ACL in the Amazon S3 User Guide .
The database in which the query execution occurred.
The name of the database used in the query execution. The database must exist in the catalog.
The name of the data catalog used in the query execution.
The completion date, current state, submission time, and state change reason (if applicable) for the query execution.
The state of query execution. QUEUED indicates that the query has been submitted to the service, and Athena will execute the query as soon as resources are available. RUNNING indicates that the query is in execution phase. SUCCEEDED indicates that the query completed without errors. FAILED indicates that the query experienced an error and did not complete processing. CANCELLED indicates that a user input interrupted query execution.
Note
Athena automatically retries your queries in cases of certain transient errors. As a result, you may see the query state transition from RUNNING or FAILED to QUEUED .
Further detail about the status of the query.
The date and time that the query was submitted.
The date and time that the query completed.
Provides information about an Athena query error.
An integer value that specifies the category of a query failure error. The following list shows the category for each integer value.
1 - System2 - User
3 - Other
An integer value that provides specific information about an Athena query error. For the meaning of specific values, see the Error Type Reference in the Amazon Athena User Guide .
True if the query might succeed if resubmitted.
Contains a short description of the error that occurred.
Query execution statistics, such as the amount of data scanned, the amount of time that the query took to process, and the type of statement that was run.
The number of milliseconds that the query took to execute.
The number of bytes in the data that was queried.
The location and file name of a data manifest file. The manifest file is saved to the Athena query results location in Amazon S3. The manifest file tracks files that the query wrote to Amazon S3. If the query fails, the manifest file also tracks files that the query intended to write. The manifest is useful for identifying orphaned files resulting from a failed query. For more information, see Working with Query Results, Output Files, and Query History in the Amazon Athena User Guide .
The number of milliseconds that Athena took to run the query.
The number of milliseconds that the query was in your query queue waiting for resources. Note that if transient errors occur, Athena might automatically add the query back to the queue.
The number of milliseconds that Athena took to plan the query processing flow. This includes the time spent retrieving table partitions from the data source. Note that because the query engine performs the query planning, query planning time is a subset of engine processing time.
The number of milliseconds that Athena took to finalize and publish the query results after the query engine finished running the query.
The name of the workgroup in which the query ran.
The engine version that executed the query.
The engine version requested by the user. Possible values are determined by the output of ListEngineVersions , including Auto. The default is Auto.
Read only. The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by a CreateWorkGroup or UpdateWorkGroup operation, the EffectiveEngineVersion field is ignored.
Information about the query executions that failed to run.
Describes a query execution that failed to process.
The unique identifier of the query execution.
The error code returned when the query execution failed to process, if applicable.
The error message returned when the query execution failed to process, if applicable.
Exceptions
Check if an operation can be paginated.
Creates (registers) a data catalog with the specified name and properties. Catalogs created are visible to all users of the same Amazon Web Services account.
See also: AWS API Documentation
Request Syntax
response = client.create_data_catalog(
Name='string',
Type='LAMBDA'|'GLUE'|'HIVE',
Description='string',
Parameters={
'string': 'string'
},
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
[REQUIRED]
The name of the data catalog to create. The catalog name must be unique for the Amazon Web Services account and can use a maximum of 127 alphanumeric, underscore, at sign, or hyphen characters. The remainder of the length constraint of 256 is reserved for use by Athena.
[REQUIRED]
The type of data catalog to create: LAMBDA for a federated catalog, HIVE for an external hive metastore, or GLUE for an Glue Data Catalog.
Specifies the Lambda function or functions to use for creating the data catalog. This is a mapping whose values depend on the catalog type.
A list of comma separated tags to add to the data catalog that is created.
A label that you assign to a resource. In Athena, a resource can be a workgroup or data catalog. Each tag consists of a key and an optional value, both of which you define. For example, you can use tags to categorize Athena workgroups or data catalogs by purpose, owner, or environment. Use a consistent set of tag keys to make it easier to search and filter workgroups or data catalogs in your account. For best practices, see Tagging Best Practices . Tag keys can be from 1 to 128 UTF-8 Unicode characters, and tag values can be from 0 to 256 UTF-8 Unicode characters. Tags can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys and values are case-sensitive. Tag keys must be unique per resource. If you specify more than one tag, separate them by commas.
A tag key. The tag key length is from 1 to 128 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys are case-sensitive and must be unique per resource.
A tag value. The tag value length is from 0 to 256 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag values are case-sensitive.
dict
Response Syntax
{}
Response Structure
Exceptions
Creates a named query in the specified workgroup. Requires that you have access to the workgroup.
For code samples using the Amazon Web Services 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',
WorkGroup='string'
)
[REQUIRED]
The query name.
[REQUIRED]
The database to which the query belongs.
[REQUIRED]
The contents of the query with all query statements.
A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another CreateNamedQuery request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the QueryString , an error is returned.
Warning
This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.
This field is autopopulated if not provided.
dict
Response Syntax
{
'NamedQueryId': 'string'
}
Response Structure
(dict) --
NamedQueryId (string) --
The unique ID of the query.
Exceptions
Creates a prepared statement for use with SQL queries in Athena.
See also: AWS API Documentation
Request Syntax
response = client.create_prepared_statement(
StatementName='string',
WorkGroup='string',
QueryStatement='string',
Description='string'
)
[REQUIRED]
The name of the prepared statement.
[REQUIRED]
The name of the workgroup to which the prepared statement belongs.
[REQUIRED]
The query string for the prepared statement.
dict
Response Syntax
{}
Response Structure
Exceptions
Creates a workgroup with the specified name.
See also: AWS API Documentation
Request Syntax
response = client.create_work_group(
Name='string',
Configuration={
'ResultConfiguration': {
'OutputLocation': 'string',
'EncryptionConfiguration': {
'EncryptionOption': 'SSE_S3'|'SSE_KMS'|'CSE_KMS',
'KmsKey': 'string'
},
'ExpectedBucketOwner': 'string',
'AclConfiguration': {
'S3AclOption': 'BUCKET_OWNER_FULL_CONTROL'
}
},
'EnforceWorkGroupConfiguration': True|False,
'PublishCloudWatchMetricsEnabled': True|False,
'BytesScannedCutoffPerQuery': 123,
'RequesterPaysEnabled': True|False,
'EngineVersion': {
'SelectedEngineVersion': 'string',
'EffectiveEngineVersion': 'string'
}
},
Description='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
[REQUIRED]
The workgroup name.
The configuration for the workgroup, which includes the location in Amazon S3 where query results are stored, the encryption configuration, if any, used for encrypting query results, whether the Amazon CloudWatch Metrics are enabled for the workgroup, the limit for the amount of bytes scanned (cutoff) per query, if it is specified, and whether workgroup's settings (specified with EnforceWorkGroupConfiguration ) in the WorkGroupConfiguration override client-side settings. See WorkGroupConfiguration$EnforceWorkGroupConfiguration .
The configuration for the workgroup, which includes the location in Amazon S3 where query results are stored and the encryption option, if any, used for query results. To run the query, you must specify the query results location using one of the ways: either in the workgroup using this setting, or for individual queries (client-side), using ResultConfiguration$OutputLocation . If none of them is set, Athena issues an error that no output location is provided. For more information, see Query Results .
The location in Amazon S3 where your query results are stored, such as s3://path/to/query/bucket/ . To run the query, you must specify the query results location using one of the ways: either for individual queries using either this setting (client-side), or in the workgroup, using WorkGroupConfiguration . If none of them is set, Athena issues an error that no output location is provided. For more information, see Query Results . If workgroup settings override client-side settings, then the query uses the settings specified for the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration .
If query results are encrypted in Amazon S3, indicates the encryption option used (for example, SSE_KMS or CSE_KMS ) and key information. This is a client-side setting. If workgroup settings override client-side settings, then the query uses the encryption configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE_S3 ), server-side encryption with KMS-managed keys (SSE_KMS ), or client-side encryption with KMS-managed keys (CSE_KMS ) is used.
If a query runs in a workgroup and the workgroup overrides client-side settings, then the workgroup's setting for encryption is used. It specifies whether query results must be encrypted, for all queries that run in this workgroup.
For SSE_KMS and CSE_KMS , this is the KMS key ARN or ID.
The Amazon Web Services account ID that you expect to be the owner of the Amazon S3 bucket specified by ResultConfiguration$OutputLocation . If set, Athena uses the value for ExpectedBucketOwner when it makes Amazon S3 calls to your specified output location. If the ExpectedBucketOwner Amazon Web Services account ID does not match the actual owner of the Amazon S3 bucket, the call fails with a permissions error.
This is a client-side setting. If workgroup settings override client-side settings, then the query uses the ExpectedBucketOwner setting that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
Indicates that an Amazon S3 canned ACL should be set to control ownership of stored query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . This is a client-side setting. If workgroup settings override client-side settings, then the query uses the ACL configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. For more information, see WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
The Amazon S3 canned ACL that Athena should specify when storing query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . If a query runs in a workgroup and the workgroup overrides client-side settings, then the Amazon S3 canned ACL specified in the workgroup's settings is used for all queries that run in the workgroup. For more information about Amazon S3 canned ACLs, see Canned ACL in the Amazon S3 User Guide .
If set to "true", the settings for the workgroup override client-side settings. If set to "false", client-side settings are used. For more information, see Workgroup Settings Override Client-Side Settings .
Indicates that the Amazon CloudWatch metrics are enabled for the workgroup.
The upper data usage limit (cutoff) for the amount of bytes a single query in a workgroup is allowed to scan.
If set to true , allows members assigned to a workgroup to reference Amazon S3 Requester Pays buckets in queries. If set to false , workgroup members cannot query data from Requester Pays buckets, and queries that retrieve data from Requester Pays buckets cause an error. The default is false . For more information about Requester Pays buckets, see Requester Pays Buckets in the Amazon Simple Storage Service Developer Guide .
The engine version that all queries running on the workgroup use. Queries on the AmazonAthenaPreviewFunctionality workgroup run on the preview engine regardless of this setting.
The engine version requested by the user. Possible values are determined by the output of ListEngineVersions , including Auto. The default is Auto.
Read only. The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by a CreateWorkGroup or UpdateWorkGroup operation, the EffectiveEngineVersion field is ignored.
A list of comma separated tags to add to the workgroup that is created.
A label that you assign to a resource. In Athena, a resource can be a workgroup or data catalog. Each tag consists of a key and an optional value, both of which you define. For example, you can use tags to categorize Athena workgroups or data catalogs by purpose, owner, or environment. Use a consistent set of tag keys to make it easier to search and filter workgroups or data catalogs in your account. For best practices, see Tagging Best Practices . Tag keys can be from 1 to 128 UTF-8 Unicode characters, and tag values can be from 0 to 256 UTF-8 Unicode characters. Tags can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys and values are case-sensitive. Tag keys must be unique per resource. If you specify more than one tag, separate them by commas.
A tag key. The tag key length is from 1 to 128 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys are case-sensitive and must be unique per resource.
A tag value. The tag value length is from 0 to 256 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag values are case-sensitive.
dict
Response Syntax
{}
Response Structure
Exceptions
Deletes a data catalog.
See also: AWS API Documentation
Request Syntax
response = client.delete_data_catalog(
Name='string'
)
[REQUIRED]
The name of the data catalog to delete.
{}
Response Structure
Exceptions
Deletes the named query if you have access to the workgroup in which the query was saved.
For code samples using the Amazon Web Services 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'
)
[REQUIRED]
The unique ID of the query to delete.
This field is autopopulated if not provided.
{}
Response Structure
Exceptions
Deletes the prepared statement with the specified name from the specified workgroup.
See also: AWS API Documentation
Request Syntax
response = client.delete_prepared_statement(
StatementName='string',
WorkGroup='string'
)
[REQUIRED]
The name of the prepared statement to delete.
[REQUIRED]
The workgroup to which the statement to be deleted belongs.
dict
Response Syntax
{}
Response Structure
Exceptions
Deletes the workgroup with the specified name. The primary workgroup cannot be deleted.
See also: AWS API Documentation
Request Syntax
response = client.delete_work_group(
WorkGroup='string',
RecursiveDeleteOption=True|False
)
[REQUIRED]
The unique name of the workgroup to delete.
dict
Response Syntax
{}
Response Structure
Exceptions
Returns the specified data catalog.
See also: AWS API Documentation
Request Syntax
response = client.get_data_catalog(
Name='string'
)
[REQUIRED]
The name of the data catalog to return.
{
'DataCatalog': {
'Name': 'string',
'Description': 'string',
'Type': 'LAMBDA'|'GLUE'|'HIVE',
'Parameters': {
'string': 'string'
}
}
}
Response Structure
The data catalog returned.
The name of the data catalog. The catalog name must be unique for the Amazon Web Services account and can use a maximum of 127 alphanumeric, underscore, at sign, or hyphen characters. The remainder of the length constraint of 256 is reserved for use by Athena.
An optional description of the data catalog.
The type of data catalog to create: LAMBDA for a federated catalog, HIVE for an external hive metastore, or GLUE for an Glue Data Catalog.
Specifies the Lambda function or functions to use for the data catalog. This is a mapping whose values depend on the catalog type.
Exceptions
Returns a database object for the specified database and data catalog.
See also: AWS API Documentation
Request Syntax
response = client.get_database(
CatalogName='string',
DatabaseName='string'
)
[REQUIRED]
The name of the data catalog that contains the database to return.
[REQUIRED]
The name of the database to return.
dict
Response Syntax
{
'Database': {
'Name': 'string',
'Description': 'string',
'Parameters': {
'string': 'string'
}
}
}
Response Structure
(dict) --
Database (dict) --
The database returned.
Name (string) --
The name of the database.
Description (string) --
An optional description of the database.
Parameters (dict) --
A set of custom key/value pairs.
Exceptions
Returns information about a single query. Requires that you have access to the workgroup in which the query was saved.
See also: AWS API Documentation
Request Syntax
response = client.get_named_query(
NamedQueryId='string'
)
[REQUIRED]
The unique ID of the query. Use ListNamedQueries to get query IDs.
{
'NamedQuery': {
'Name': 'string',
'Description': 'string',
'Database': 'string',
'QueryString': 'string',
'NamedQueryId': 'string',
'WorkGroup': 'string'
}
}
Response Structure
Information about the query.
The query name.
The query description.
The database to which the query belongs.
The SQL statements that make up the query.
The unique identifier of the query.
The name of the workgroup that contains the named query.
Exceptions
Create a paginator for an operation.
Retrieves the prepared statement with the specified name from the specified workgroup.
See also: AWS API Documentation
Request Syntax
response = client.get_prepared_statement(
StatementName='string',
WorkGroup='string'
)
[REQUIRED]
The name of the prepared statement to retrieve.
[REQUIRED]
The workgroup to which the statement to be retrieved belongs.
dict
Response Syntax
{
'PreparedStatement': {
'StatementName': 'string',
'QueryStatement': 'string',
'WorkGroupName': 'string',
'Description': 'string',
'LastModifiedTime': datetime(2015, 1, 1)
}
}
Response Structure
(dict) --
PreparedStatement (dict) --
The name of the prepared statement that was retrieved.
StatementName (string) --
The name of the prepared statement.
QueryStatement (string) --
The query string for the prepared statement.
WorkGroupName (string) --
The name of the workgroup to which the prepared statement belongs.
Description (string) --
The description of the prepared statement.
LastModifiedTime (datetime) --
The last modified time of the prepared statement.
Exceptions
Returns information about a single execution of a query if you have access to the workgroup in which the query ran. 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'
)
[REQUIRED]
The unique ID of the query execution.
{
'QueryExecution': {
'QueryExecutionId': 'string',
'Query': 'string',
'StatementType': 'DDL'|'DML'|'UTILITY',
'ResultConfiguration': {
'OutputLocation': 'string',
'EncryptionConfiguration': {
'EncryptionOption': 'SSE_S3'|'SSE_KMS'|'CSE_KMS',
'KmsKey': 'string'
},
'ExpectedBucketOwner': 'string',
'AclConfiguration': {
'S3AclOption': 'BUCKET_OWNER_FULL_CONTROL'
}
},
'QueryExecutionContext': {
'Database': 'string',
'Catalog': 'string'
},
'Status': {
'State': 'QUEUED'|'RUNNING'|'SUCCEEDED'|'FAILED'|'CANCELLED',
'StateChangeReason': 'string',
'SubmissionDateTime': datetime(2015, 1, 1),
'CompletionDateTime': datetime(2015, 1, 1),
'AthenaError': {
'ErrorCategory': 123,
'ErrorType': 123,
'Retryable': True|False,
'ErrorMessage': 'string'
}
},
'Statistics': {
'EngineExecutionTimeInMillis': 123,
'DataScannedInBytes': 123,
'DataManifestLocation': 'string',
'TotalExecutionTimeInMillis': 123,
'QueryQueueTimeInMillis': 123,
'QueryPlanningTimeInMillis': 123,
'ServiceProcessingTimeInMillis': 123
},
'WorkGroup': 'string',
'EngineVersion': {
'SelectedEngineVersion': 'string',
'EffectiveEngineVersion': 'string'
}
}
}
Response Structure
Information about the query execution.
The unique identifier for each query execution.
The SQL query statements which the query execution ran.
The type of query statement that was run. DDL indicates DDL query statements. DML indicates DML (Data Manipulation Language) query statements, such as CREATE TABLE AS SELECT . UTILITY indicates query statements other than DDL and DML, such as SHOW CREATE TABLE , or DESCRIBE TABLE .
The location in Amazon S3 where query results were stored and the encryption option, if any, used for query results. These are known as "client-side settings". If workgroup settings override client-side settings, then the query uses the location for the query results and the encryption configuration that are specified for the workgroup.
The location in Amazon S3 where your query results are stored, such as s3://path/to/query/bucket/ . To run the query, you must specify the query results location using one of the ways: either for individual queries using either this setting (client-side), or in the workgroup, using WorkGroupConfiguration . If none of them is set, Athena issues an error that no output location is provided. For more information, see Query Results . If workgroup settings override client-side settings, then the query uses the settings specified for the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration .
If query results are encrypted in Amazon S3, indicates the encryption option used (for example, SSE_KMS or CSE_KMS ) and key information. This is a client-side setting. If workgroup settings override client-side settings, then the query uses the encryption configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE_S3 ), server-side encryption with KMS-managed keys (SSE_KMS ), or client-side encryption with KMS-managed keys (CSE_KMS ) is used.
If a query runs in a workgroup and the workgroup overrides client-side settings, then the workgroup's setting for encryption is used. It specifies whether query results must be encrypted, for all queries that run in this workgroup.
For SSE_KMS and CSE_KMS , this is the KMS key ARN or ID.
The Amazon Web Services account ID that you expect to be the owner of the Amazon S3 bucket specified by ResultConfiguration$OutputLocation . If set, Athena uses the value for ExpectedBucketOwner when it makes Amazon S3 calls to your specified output location. If the ExpectedBucketOwner Amazon Web Services account ID does not match the actual owner of the Amazon S3 bucket, the call fails with a permissions error.
This is a client-side setting. If workgroup settings override client-side settings, then the query uses the ExpectedBucketOwner setting that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
Indicates that an Amazon S3 canned ACL should be set to control ownership of stored query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . This is a client-side setting. If workgroup settings override client-side settings, then the query uses the ACL configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. For more information, see WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
The Amazon S3 canned ACL that Athena should specify when storing query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . If a query runs in a workgroup and the workgroup overrides client-side settings, then the Amazon S3 canned ACL specified in the workgroup's settings is used for all queries that run in the workgroup. For more information about Amazon S3 canned ACLs, see Canned ACL in the Amazon S3 User Guide .
The database in which the query execution occurred.
The name of the database used in the query execution. The database must exist in the catalog.
The name of the data catalog used in the query execution.
The completion date, current state, submission time, and state change reason (if applicable) for the query execution.
The state of query execution. QUEUED indicates that the query has been submitted to the service, and Athena will execute the query as soon as resources are available. RUNNING indicates that the query is in execution phase. SUCCEEDED indicates that the query completed without errors. FAILED indicates that the query experienced an error and did not complete processing. CANCELLED indicates that a user input interrupted query execution.
Note
Athena automatically retries your queries in cases of certain transient errors. As a result, you may see the query state transition from RUNNING or FAILED to QUEUED .
Further detail about the status of the query.
The date and time that the query was submitted.
The date and time that the query completed.
Provides information about an Athena query error.
An integer value that specifies the category of a query failure error. The following list shows the category for each integer value.
1 - System2 - User
3 - Other
An integer value that provides specific information about an Athena query error. For the meaning of specific values, see the Error Type Reference in the Amazon Athena User Guide .
True if the query might succeed if resubmitted.
Contains a short description of the error that occurred.
Query execution statistics, such as the amount of data scanned, the amount of time that the query took to process, and the type of statement that was run.
The number of milliseconds that the query took to execute.
The number of bytes in the data that was queried.
The location and file name of a data manifest file. The manifest file is saved to the Athena query results location in Amazon S3. The manifest file tracks files that the query wrote to Amazon S3. If the query fails, the manifest file also tracks files that the query intended to write. The manifest is useful for identifying orphaned files resulting from a failed query. For more information, see Working with Query Results, Output Files, and Query History in the Amazon Athena User Guide .
The number of milliseconds that Athena took to run the query.
The number of milliseconds that the query was in your query queue waiting for resources. Note that if transient errors occur, Athena might automatically add the query back to the queue.
The number of milliseconds that Athena took to plan the query processing flow. This includes the time spent retrieving table partitions from the data source. Note that because the query engine performs the query planning, query planning time is a subset of engine processing time.
The number of milliseconds that Athena took to finalize and publish the query results after the query engine finished running the query.
The name of the workgroup in which the query ran.
The engine version that executed the query.
The engine version requested by the user. Possible values are determined by the output of ListEngineVersions , including Auto. The default is Auto.
Read only. The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by a CreateWorkGroup or UpdateWorkGroup operation, the EffectiveEngineVersion field is ignored.
Exceptions
Streams the results of a single query execution specified by QueryExecutionId from the Athena query results location in Amazon S3. For more information, see Query Results 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.
Warning
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.
See also: AWS API Documentation
Request Syntax
response = client.get_query_results(
QueryExecutionId='string',
NextToken='string',
MaxResults=123
)
[REQUIRED]
The unique ID of the query execution.
dict
Response Syntax
{
'UpdateCount': 123,
'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
(dict) --
UpdateCount (integer) --
The number of rows inserted with a CREATE TABLE AS SELECT statement.
ResultSet (dict) --
The results of the query execution.
Rows (list) --
The rows in the table.
(dict) --
The rows that make up a query result table.
Data (list) --
The data that populates a row in a query result table.
(dict) --
A piece of data (a field in the table).
VarCharValue (string) --
The value of the datum.
ResultSetMetadata (dict) --
The metadata that describes the column structure and data types of a table of query results.
ColumnInfo (list) --
Information about the columns returned in a query result metadata.
(dict) --
Information about the columns in a query execution result.
CatalogName (string) --
The catalog to which the query results belong.
SchemaName (string) --
The schema name (database name) to which the query results belong.
TableName (string) --
The table name for the query results.
Name (string) --
The name of the column.
Label (string) --
A column label.
Type (string) --
The data type of the column.
Precision (integer) --
For DECIMAL data types, specifies the total number of digits, up to 38. For performance reasons, we recommend up to 18 digits.
Scale (integer) --
For DECIMAL data types, specifies the total number of digits in the fractional part of the value. Defaults to 0.
Nullable (string) --
Indicates the column's nullable status.
CaseSensitive (boolean) --
Indicates whether values in the column are case-sensitive.
NextToken (string) --
A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.
Exceptions
Returns table metadata for the specified catalog, database, and table.
See also: AWS API Documentation
Request Syntax
response = client.get_table_metadata(
CatalogName='string',
DatabaseName='string',
TableName='string'
)
[REQUIRED]
The name of the data catalog that contains the database and table metadata to return.
[REQUIRED]
The name of the database that contains the table metadata to return.
[REQUIRED]
The name of the table for which metadata is returned.
dict
Response Syntax
{
'TableMetadata': {
'Name': 'string',
'CreateTime': datetime(2015, 1, 1),
'LastAccessTime': datetime(2015, 1, 1),
'TableType': 'string',
'Columns': [
{
'Name': 'string',
'Type': 'string',
'Comment': 'string'
},
],
'PartitionKeys': [
{
'Name': 'string',
'Type': 'string',
'Comment': 'string'
},
],
'Parameters': {
'string': 'string'
}
}
}
Response Structure
(dict) --
TableMetadata (dict) --
An object that contains table metadata.
Name (string) --
The name of the table.
CreateTime (datetime) --
The time that the table was created.
LastAccessTime (datetime) --
The last time the table was accessed.
TableType (string) --
The type of table. In Athena, only EXTERNAL_TABLE is supported.
Columns (list) --
A list of the columns in the table.
(dict) --
Contains metadata for a column in a table.
Name (string) --
The name of the column.
Type (string) --
The data type of the column.
Comment (string) --
Optional information about the column.
PartitionKeys (list) --
A list of the partition keys in the table.
(dict) --
Contains metadata for a column in a table.
Name (string) --
The name of the column.
Type (string) --
The data type of the column.
Comment (string) --
Optional information about the column.
Parameters (dict) --
A set of custom key/value pairs for table properties.
Exceptions
Returns an object that can wait for some condition.
Returns information about the workgroup with the specified name.
See also: AWS API Documentation
Request Syntax
response = client.get_work_group(
WorkGroup='string'
)
[REQUIRED]
The name of the workgroup.
{
'WorkGroup': {
'Name': 'string',
'State': 'ENABLED'|'DISABLED',
'Configuration': {
'ResultConfiguration': {
'OutputLocation': 'string',
'EncryptionConfiguration': {
'EncryptionOption': 'SSE_S3'|'SSE_KMS'|'CSE_KMS',
'KmsKey': 'string'
},
'ExpectedBucketOwner': 'string',
'AclConfiguration': {
'S3AclOption': 'BUCKET_OWNER_FULL_CONTROL'
}
},
'EnforceWorkGroupConfiguration': True|False,
'PublishCloudWatchMetricsEnabled': True|False,
'BytesScannedCutoffPerQuery': 123,
'RequesterPaysEnabled': True|False,
'EngineVersion': {
'SelectedEngineVersion': 'string',
'EffectiveEngineVersion': 'string'
}
},
'Description': 'string',
'CreationTime': datetime(2015, 1, 1)
}
}
Response Structure
Information about the workgroup.
The workgroup name.
The state of the workgroup: ENABLED or DISABLED.
The configuration of the workgroup, which includes the location in Amazon S3 where query results are stored, the encryption configuration, if any, used for query results; whether the Amazon CloudWatch Metrics are enabled for the workgroup; whether workgroup settings override client-side settings; and the data usage limits for the amount of data scanned per query or per workgroup. The workgroup settings override is specified in EnforceWorkGroupConfiguration (true/false) in the WorkGroupConfiguration . See WorkGroupConfiguration$EnforceWorkGroupConfiguration .
The configuration for the workgroup, which includes the location in Amazon S3 where query results are stored and the encryption option, if any, used for query results. To run the query, you must specify the query results location using one of the ways: either in the workgroup using this setting, or for individual queries (client-side), using ResultConfiguration$OutputLocation . If none of them is set, Athena issues an error that no output location is provided. For more information, see Query Results .
The location in Amazon S3 where your query results are stored, such as s3://path/to/query/bucket/ . To run the query, you must specify the query results location using one of the ways: either for individual queries using either this setting (client-side), or in the workgroup, using WorkGroupConfiguration . If none of them is set, Athena issues an error that no output location is provided. For more information, see Query Results . If workgroup settings override client-side settings, then the query uses the settings specified for the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration .
If query results are encrypted in Amazon S3, indicates the encryption option used (for example, SSE_KMS or CSE_KMS ) and key information. This is a client-side setting. If workgroup settings override client-side settings, then the query uses the encryption configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE_S3 ), server-side encryption with KMS-managed keys (SSE_KMS ), or client-side encryption with KMS-managed keys (CSE_KMS ) is used.
If a query runs in a workgroup and the workgroup overrides client-side settings, then the workgroup's setting for encryption is used. It specifies whether query results must be encrypted, for all queries that run in this workgroup.
For SSE_KMS and CSE_KMS , this is the KMS key ARN or ID.
The Amazon Web Services account ID that you expect to be the owner of the Amazon S3 bucket specified by ResultConfiguration$OutputLocation . If set, Athena uses the value for ExpectedBucketOwner when it makes Amazon S3 calls to your specified output location. If the ExpectedBucketOwner Amazon Web Services account ID does not match the actual owner of the Amazon S3 bucket, the call fails with a permissions error.
This is a client-side setting. If workgroup settings override client-side settings, then the query uses the ExpectedBucketOwner setting that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
Indicates that an Amazon S3 canned ACL should be set to control ownership of stored query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . This is a client-side setting. If workgroup settings override client-side settings, then the query uses the ACL configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. For more information, see WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
The Amazon S3 canned ACL that Athena should specify when storing query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . If a query runs in a workgroup and the workgroup overrides client-side settings, then the Amazon S3 canned ACL specified in the workgroup's settings is used for all queries that run in the workgroup. For more information about Amazon S3 canned ACLs, see Canned ACL in the Amazon S3 User Guide .
If set to "true", the settings for the workgroup override client-side settings. If set to "false", client-side settings are used. For more information, see Workgroup Settings Override Client-Side Settings .
Indicates that the Amazon CloudWatch metrics are enabled for the workgroup.
The upper data usage limit (cutoff) for the amount of bytes a single query in a workgroup is allowed to scan.
If set to true , allows members assigned to a workgroup to reference Amazon S3 Requester Pays buckets in queries. If set to false , workgroup members cannot query data from Requester Pays buckets, and queries that retrieve data from Requester Pays buckets cause an error. The default is false . For more information about Requester Pays buckets, see Requester Pays Buckets in the Amazon Simple Storage Service Developer Guide .
The engine version that all queries running on the workgroup use. Queries on the AmazonAthenaPreviewFunctionality workgroup run on the preview engine regardless of this setting.
The engine version requested by the user. Possible values are determined by the output of ListEngineVersions , including Auto. The default is Auto.
Read only. The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by a CreateWorkGroup or UpdateWorkGroup operation, the EffectiveEngineVersion field is ignored.
The workgroup description.
The date and time the workgroup was created.
Exceptions
Lists the data catalogs in the current Amazon Web Services account.
See also: AWS API Documentation
Request Syntax
response = client.list_data_catalogs(
NextToken='string',
MaxResults=123
)
dict
Response Syntax
{
'DataCatalogsSummary': [
{
'CatalogName': 'string',
'Type': 'LAMBDA'|'GLUE'|'HIVE'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
DataCatalogsSummary (list) --
A summary list of data catalogs.
(dict) --
The summary information for the data catalog, which includes its name and type.
CatalogName (string) --
The name of the data catalog. The catalog name is unique for the Amazon Web Services account and can use a maximum of 127 alphanumeric, underscore, at sign, or hyphen characters. The remainder of the length constraint of 256 is reserved for use by Athena.
Type (string) --
The data catalog type.
NextToken (string) --
A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.
Exceptions
Lists the databases in the specified data catalog.
See also: AWS API Documentation
Request Syntax
response = client.list_databases(
CatalogName='string',
NextToken='string',
MaxResults=123
)
[REQUIRED]
The name of the data catalog that contains the databases to return.
dict
Response Syntax
{
'DatabaseList': [
{
'Name': 'string',
'Description': 'string',
'Parameters': {
'string': 'string'
}
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
DatabaseList (list) --
A list of databases from a data catalog.
(dict) --
Contains metadata information for a database in a data catalog.
Name (string) --
The name of the database.
Description (string) --
An optional description of the database.
Parameters (dict) --
A set of custom key/value pairs.
NextToken (string) --
A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.
Exceptions
Returns a list of engine versions that are available to choose from, including the Auto option.
See also: AWS API Documentation
Request Syntax
response = client.list_engine_versions(
NextToken='string',
MaxResults=123
)
dict
Response Syntax
{
'EngineVersions': [
{
'SelectedEngineVersion': 'string',
'EffectiveEngineVersion': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
EngineVersions (list) --
A list of engine versions that are available to choose from.
(dict) --
The Athena engine version for running queries.
SelectedEngineVersion (string) --
The engine version requested by the user. Possible values are determined by the output of ListEngineVersions , including Auto. The default is Auto.
EffectiveEngineVersion (string) --
Read only. The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by a CreateWorkGroup or UpdateWorkGroup operation, the EffectiveEngineVersion field is ignored.
NextToken (string) --
A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.
Exceptions
Provides a list of available query IDs only for queries saved in the specified workgroup. Requires that you have access to the specified workgroup. If a workgroup is not specified, lists the saved queries for the primary workgroup.
For code samples using the Amazon Web Services 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,
WorkGroup='string'
)
dict
Response Syntax
{
'NamedQueryIds': [
'string',
],
'NextToken': 'string'
}
Response Structure
(dict) --
NamedQueryIds (list) --
The list of unique query IDs.
NextToken (string) --
A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.
Exceptions
Lists the prepared statements in the specfied workgroup.
See also: AWS API Documentation
Request Syntax
response = client.list_prepared_statements(
WorkGroup='string',
NextToken='string',
MaxResults=123
)
[REQUIRED]
The workgroup to list the prepared statements for.
dict
Response Syntax
{
'PreparedStatements': [
{
'StatementName': 'string',
'LastModifiedTime': datetime(2015, 1, 1)
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
PreparedStatements (list) --
The list of prepared statements for the workgroup.
(dict) --
The name and last modified time of the prepared statement.
StatementName (string) --
The name of the prepared statement.
LastModifiedTime (datetime) --
The last modified time of the prepared statement.
NextToken (string) --
A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.
Exceptions
Provides a list of available query execution IDs for the queries in the specified workgroup. If a workgroup is not specified, returns a list of query execution IDs for the primary workgroup. Requires you to have access to the workgroup in which the queries ran.
For code samples using the Amazon Web Services 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,
WorkGroup='string'
)
dict
Response Syntax
{
'QueryExecutionIds': [
'string',
],
'NextToken': 'string'
}
Response Structure
(dict) --
QueryExecutionIds (list) --
The unique IDs of each query execution as an array of strings.
NextToken (string) --
A token to be used by the next request if this request is truncated.
Exceptions
Lists the metadata for the tables in the specified data catalog database.
See also: AWS API Documentation
Request Syntax
response = client.list_table_metadata(
CatalogName='string',
DatabaseName='string',
Expression='string',
NextToken='string',
MaxResults=123
)
[REQUIRED]
The name of the data catalog for which table metadata should be returned.
[REQUIRED]
The name of the database for which table metadata should be returned.
dict
Response Syntax
{
'TableMetadataList': [
{
'Name': 'string',
'CreateTime': datetime(2015, 1, 1),
'LastAccessTime': datetime(2015, 1, 1),
'TableType': 'string',
'Columns': [
{
'Name': 'string',
'Type': 'string',
'Comment': 'string'
},
],
'PartitionKeys': [
{
'Name': 'string',
'Type': 'string',
'Comment': 'string'
},
],
'Parameters': {
'string': 'string'
}
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
TableMetadataList (list) --
A list of table metadata.
(dict) --
Contains metadata for a table.
Name (string) --
The name of the table.
CreateTime (datetime) --
The time that the table was created.
LastAccessTime (datetime) --
The last time the table was accessed.
TableType (string) --
The type of table. In Athena, only EXTERNAL_TABLE is supported.
Columns (list) --
A list of the columns in the table.
(dict) --
Contains metadata for a column in a table.
Name (string) --
The name of the column.
Type (string) --
The data type of the column.
Comment (string) --
Optional information about the column.
PartitionKeys (list) --
A list of the partition keys in the table.
(dict) --
Contains metadata for a column in a table.
Name (string) --
The name of the column.
Type (string) --
The data type of the column.
Comment (string) --
Optional information about the column.
Parameters (dict) --
A set of custom key/value pairs for table properties.
NextToken (string) --
A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.
Exceptions
Lists the tags associated with an Athena workgroup or data catalog resource.
See also: AWS API Documentation
Request Syntax
response = client.list_tags_for_resource(
ResourceARN='string',
NextToken='string',
MaxResults=123
)
[REQUIRED]
Lists the tags for the resource with the specified ARN.
dict
Response Syntax
{
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Tags (list) --
The list of tags associated with the specified resource.
(dict) --
A label that you assign to a resource. In Athena, a resource can be a workgroup or data catalog. Each tag consists of a key and an optional value, both of which you define. For example, you can use tags to categorize Athena workgroups or data catalogs by purpose, owner, or environment. Use a consistent set of tag keys to make it easier to search and filter workgroups or data catalogs in your account. For best practices, see Tagging Best Practices . Tag keys can be from 1 to 128 UTF-8 Unicode characters, and tag values can be from 0 to 256 UTF-8 Unicode characters. Tags can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys and values are case-sensitive. Tag keys must be unique per resource. If you specify more than one tag, separate them by commas.
Key (string) --
A tag key. The tag key length is from 1 to 128 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys are case-sensitive and must be unique per resource.
Value (string) --
A tag value. The tag value length is from 0 to 256 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag values are case-sensitive.
NextToken (string) --
A token to be used by the next request if this request is truncated.
Exceptions
Lists available workgroups for the account.
See also: AWS API Documentation
Request Syntax
response = client.list_work_groups(
NextToken='string',
MaxResults=123
)
dict
Response Syntax
{
'WorkGroups': [
{
'Name': 'string',
'State': 'ENABLED'|'DISABLED',
'Description': 'string',
'CreationTime': datetime(2015, 1, 1),
'EngineVersion': {
'SelectedEngineVersion': 'string',
'EffectiveEngineVersion': 'string'
}
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
WorkGroups (list) --
A list of WorkGroupSummary objects that include the names, descriptions, creation times, and states for each workgroup.
(dict) --
The summary information for the workgroup, which includes its name, state, description, and the date and time it was created.
Name (string) --
The name of the workgroup.
State (string) --
The state of the workgroup.
Description (string) --
The workgroup description.
CreationTime (datetime) --
The workgroup creation date and time.
EngineVersion (dict) --
The engine version setting for all queries on the workgroup. Queries on the AmazonAthenaPreviewFunctionality workgroup run on the preview engine regardless of this setting.
SelectedEngineVersion (string) --
The engine version requested by the user. Possible values are determined by the output of ListEngineVersions , including Auto. The default is Auto.
EffectiveEngineVersion (string) --
Read only. The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by a CreateWorkGroup or UpdateWorkGroup operation, the EffectiveEngineVersion field is ignored.
NextToken (string) --
A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.
Exceptions
Runs the SQL query statements contained in the Query . Requires you to have access to the workgroup in which the query ran. Running queries against an external catalog requires GetDataCatalog permission to the catalog. For code samples using the Amazon Web Services 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',
'Catalog': 'string'
},
ResultConfiguration={
'OutputLocation': 'string',
'EncryptionConfiguration': {
'EncryptionOption': 'SSE_S3'|'SSE_KMS'|'CSE_KMS',
'KmsKey': 'string'
},
'ExpectedBucketOwner': 'string',
'AclConfiguration': {
'S3AclOption': 'BUCKET_OWNER_FULL_CONTROL'
}
},
WorkGroup='string'
)
[REQUIRED]
The SQL query statements to be executed.
A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another StartQueryExecution request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the QueryString , an error is returned.
Warning
This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.
This field is autopopulated if not provided.
The database within which the query executes.
The name of the database used in the query execution. The database must exist in the catalog.
The name of the data catalog used in the query execution.
Specifies information about where and how to save the results of the query execution. If the query runs in a workgroup, then workgroup's settings may override query settings. This affects the query results location. The workgroup settings override is specified in EnforceWorkGroupConfiguration (true/false) in the WorkGroupConfiguration. See WorkGroupConfiguration$EnforceWorkGroupConfiguration .
The location in Amazon S3 where your query results are stored, such as s3://path/to/query/bucket/ . To run the query, you must specify the query results location using one of the ways: either for individual queries using either this setting (client-side), or in the workgroup, using WorkGroupConfiguration . If none of them is set, Athena issues an error that no output location is provided. For more information, see Query Results . If workgroup settings override client-side settings, then the query uses the settings specified for the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration .
If query results are encrypted in Amazon S3, indicates the encryption option used (for example, SSE_KMS or CSE_KMS ) and key information. This is a client-side setting. If workgroup settings override client-side settings, then the query uses the encryption configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE_S3 ), server-side encryption with KMS-managed keys (SSE_KMS ), or client-side encryption with KMS-managed keys (CSE_KMS ) is used.
If a query runs in a workgroup and the workgroup overrides client-side settings, then the workgroup's setting for encryption is used. It specifies whether query results must be encrypted, for all queries that run in this workgroup.
For SSE_KMS and CSE_KMS , this is the KMS key ARN or ID.
The Amazon Web Services account ID that you expect to be the owner of the Amazon S3 bucket specified by ResultConfiguration$OutputLocation . If set, Athena uses the value for ExpectedBucketOwner when it makes Amazon S3 calls to your specified output location. If the ExpectedBucketOwner Amazon Web Services account ID does not match the actual owner of the Amazon S3 bucket, the call fails with a permissions error.
This is a client-side setting. If workgroup settings override client-side settings, then the query uses the ExpectedBucketOwner setting that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
Indicates that an Amazon S3 canned ACL should be set to control ownership of stored query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . This is a client-side setting. If workgroup settings override client-side settings, then the query uses the ACL configuration that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. For more information, see WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
The Amazon S3 canned ACL that Athena should specify when storing query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . If a query runs in a workgroup and the workgroup overrides client-side settings, then the Amazon S3 canned ACL specified in the workgroup's settings is used for all queries that run in the workgroup. For more information about Amazon S3 canned ACLs, see Canned ACL in the Amazon S3 User Guide .
dict
Response Syntax
{
'QueryExecutionId': 'string'
}
Response Structure
(dict) --
QueryExecutionId (string) --
The unique ID of the query that ran as a result of this request.
Exceptions
Stops a query execution. Requires you to have access to the workgroup in which the query ran.
For code samples using the Amazon Web Services 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'
)
[REQUIRED]
The unique ID of the query execution to stop.
This field is autopopulated if not provided.
{}
Response Structure
Exceptions
Adds one or more tags to an Athena resource. A tag is a label that you assign to a resource. In Athena, a resource can be a workgroup or data catalog. Each tag consists of a key and an optional value, both of which you define. For example, you can use tags to categorize Athena workgroups or data catalogs by purpose, owner, or environment. Use a consistent set of tag keys to make it easier to search and filter workgroups or data catalogs in your account. For best practices, see Tagging Best Practices . Tag keys can be from 1 to 128 UTF-8 Unicode characters, and tag values can be from 0 to 256 UTF-8 Unicode characters. Tags can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys and values are case-sensitive. Tag keys must be unique per resource. If you specify more than one tag, separate them by commas.
See also: AWS API Documentation
Request Syntax
response = client.tag_resource(
ResourceARN='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
[REQUIRED]
Specifies the ARN of the Athena resource (workgroup or data catalog) to which tags are to be added.
[REQUIRED]
A collection of one or more tags, separated by commas, to be added to an Athena workgroup or data catalog resource.
A label that you assign to a resource. In Athena, a resource can be a workgroup or data catalog. Each tag consists of a key and an optional value, both of which you define. For example, you can use tags to categorize Athena workgroups or data catalogs by purpose, owner, or environment. Use a consistent set of tag keys to make it easier to search and filter workgroups or data catalogs in your account. For best practices, see Tagging Best Practices . Tag keys can be from 1 to 128 UTF-8 Unicode characters, and tag values can be from 0 to 256 UTF-8 Unicode characters. Tags can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys and values are case-sensitive. Tag keys must be unique per resource. If you specify more than one tag, separate them by commas.
A tag key. The tag key length is from 1 to 128 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys are case-sensitive and must be unique per resource.
A tag value. The tag value length is from 0 to 256 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag values are case-sensitive.
dict
Response Syntax
{}
Response Structure
Exceptions
Removes one or more tags from a data catalog or workgroup resource.
See also: AWS API Documentation
Request Syntax
response = client.untag_resource(
ResourceARN='string',
TagKeys=[
'string',
]
)
[REQUIRED]
Specifies the ARN of the resource from which tags are to be removed.
[REQUIRED]
A comma-separated list of one or more tag keys whose tags are to be removed from the specified resource.
dict
Response Syntax
{}
Response Structure
Exceptions
Updates the data catalog that has the specified name.
See also: AWS API Documentation
Request Syntax
response = client.update_data_catalog(
Name='string',
Type='LAMBDA'|'GLUE'|'HIVE',
Description='string',
Parameters={
'string': 'string'
}
)
[REQUIRED]
The name of the data catalog to update. The catalog name must be unique for the Amazon Web Services account and can use a maximum of 127 alphanumeric, underscore, at sign, or hyphen characters. The remainder of the length constraint of 256 is reserved for use by Athena.
[REQUIRED]
Specifies the type of data catalog to update. Specify LAMBDA for a federated catalog, HIVE for an external hive metastore, or GLUE for an Glue Data Catalog.
Specifies the Lambda function or functions to use for updating the data catalog. This is a mapping whose values depend on the catalog type.
dict
Response Syntax
{}
Response Structure
Exceptions
Updates a NamedQuery object. The database or workgroup cannot be updated.
See also: AWS API Documentation
Request Syntax
response = client.update_named_query(
NamedQueryId='string',
Name='string',
Description='string',
QueryString='string'
)
[REQUIRED]
The unique identifier (UUID) of the query.
[REQUIRED]
The name of the query.
[REQUIRED]
The contents of the query with all query statements.
dict
Response Syntax
{}
Response Structure
Exceptions
Updates a prepared statement.
See also: AWS API Documentation
Request Syntax
response = client.update_prepared_statement(
StatementName='string',
WorkGroup='string',
QueryStatement='string',
Description='string'
)
[REQUIRED]
The name of the prepared statement.
[REQUIRED]
The workgroup for the prepared statement.
[REQUIRED]
The query string for the prepared statement.
dict
Response Syntax
{}
Response Structure
Exceptions
Updates the workgroup with the specified name. The workgroup's name cannot be changed.
See also: AWS API Documentation
Request Syntax
response = client.update_work_group(
WorkGroup='string',
Description='string',
ConfigurationUpdates={
'EnforceWorkGroupConfiguration': True|False,
'ResultConfigurationUpdates': {
'OutputLocation': 'string',
'RemoveOutputLocation': True|False,
'EncryptionConfiguration': {
'EncryptionOption': 'SSE_S3'|'SSE_KMS'|'CSE_KMS',
'KmsKey': 'string'
},
'RemoveEncryptionConfiguration': True|False,
'ExpectedBucketOwner': 'string',
'RemoveExpectedBucketOwner': True|False,
'AclConfiguration': {
'S3AclOption': 'BUCKET_OWNER_FULL_CONTROL'
},
'RemoveAclConfiguration': True|False
},
'PublishCloudWatchMetricsEnabled': True|False,
'BytesScannedCutoffPerQuery': 123,
'RemoveBytesScannedCutoffPerQuery': True|False,
'RequesterPaysEnabled': True|False,
'EngineVersion': {
'SelectedEngineVersion': 'string',
'EffectiveEngineVersion': 'string'
}
},
State='ENABLED'|'DISABLED'
)
[REQUIRED]
The specified workgroup that will be updated.
The workgroup configuration that will be updated for the given workgroup.
If set to "true", the settings for the workgroup override client-side settings. If set to "false" client-side settings are used. For more information, see Workgroup Settings Override Client-Side Settings .
The result configuration information about the queries in this workgroup that will be updated. Includes the updated results location and an updated option for encrypting query results.
The location in Amazon S3 where your query results are stored, such as s3://path/to/query/bucket/ . For more information, see Query Results If workgroup settings override client-side settings, then the query uses the location for the query results and the encryption configuration that are specified for the workgroup. The "workgroup settings override" is specified in EnforceWorkGroupConfiguration (true/false) in the WorkGroupConfiguration . See WorkGroupConfiguration$EnforceWorkGroupConfiguration .
If set to "true", indicates that the previously-specified query results location (also known as a client-side setting) for queries in this workgroup should be ignored and set to null. If set to "false" or not set, and a value is present in the OutputLocation in ResultConfigurationUpdates (the client-side setting), the OutputLocation in the workgroup's ResultConfiguration will be updated with the new value. For more information, see Workgroup Settings Override Client-Side Settings .
The encryption configuration for the query results.
Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE_S3 ), server-side encryption with KMS-managed keys (SSE_KMS ), or client-side encryption with KMS-managed keys (CSE_KMS ) is used.
If a query runs in a workgroup and the workgroup overrides client-side settings, then the workgroup's setting for encryption is used. It specifies whether query results must be encrypted, for all queries that run in this workgroup.
For SSE_KMS and CSE_KMS , this is the KMS key ARN or ID.
If set to "true", indicates that the previously-specified encryption configuration (also known as the client-side setting) for queries in this workgroup should be ignored and set to null. If set to "false" or not set, and a value is present in the EncryptionConfiguration in ResultConfigurationUpdates (the client-side setting), the EncryptionConfiguration in the workgroup's ResultConfiguration will be updated with the new value. For more information, see Workgroup Settings Override Client-Side Settings .
The Amazon Web Services account ID that you expect to be the owner of the Amazon S3 bucket specified by ResultConfiguration$OutputLocation . If set, Athena uses the value for ExpectedBucketOwner when it makes Amazon S3 calls to your specified output location. If the ExpectedBucketOwner Amazon Web Services account ID does not match the actual owner of the Amazon S3 bucket, the call fails with a permissions error.
If workgroup settings override client-side settings, then the query uses the ExpectedBucketOwner setting that is specified for the workgroup, and also uses the location for storing query results specified in the workgroup. See WorkGroupConfiguration$EnforceWorkGroupConfiguration and Workgroup Settings Override Client-Side Settings .
If set to "true", removes the Amazon Web Services account ID previously specified for ResultConfiguration$ExpectedBucketOwner . If set to "false" or not set, and a value is present in the ExpectedBucketOwner in ResultConfigurationUpdates (the client-side setting), the ExpectedBucketOwner in the workgroup's ResultConfiguration is updated with the new value. For more information, see Workgroup Settings Override Client-Side Settings .
The ACL configuration for the query results.
The Amazon S3 canned ACL that Athena should specify when storing query results. Currently the only supported canned ACL is BUCKET_OWNER_FULL_CONTROL . If a query runs in a workgroup and the workgroup overrides client-side settings, then the Amazon S3 canned ACL specified in the workgroup's settings is used for all queries that run in the workgroup. For more information about Amazon S3 canned ACLs, see Canned ACL in the Amazon S3 User Guide .
If set to true , indicates that the previously-specified ACL configuration for queries in this workgroup should be ignored and set to null. If set to false or not set, and a value is present in the AclConfiguration of ResultConfigurationUpdates , the AclConfiguration in the workgroup's ResultConfiguration is updated with the new value. For more information, see Workgroup Settings Override Client-Side Settings .
Indicates whether this workgroup enables publishing metrics to Amazon CloudWatch.
The upper limit (cutoff) for the amount of bytes a single query in a workgroup is allowed to scan.
Indicates that the data usage control limit per query is removed. WorkGroupConfiguration$BytesScannedCutoffPerQuery
If set to true , allows members assigned to a workgroup to specify Amazon S3 Requester Pays buckets in queries. If set to false , workgroup members cannot query data from Requester Pays buckets, and queries that retrieve data from Requester Pays buckets cause an error. The default is false . For more information about Requester Pays buckets, see Requester Pays Buckets in the Amazon Simple Storage Service Developer Guide .
The engine version requested when a workgroup is updated. After the update, all queries on the workgroup run on the requested engine version. If no value was previously set, the default is Auto. Queries on the AmazonAthenaPreviewFunctionality workgroup run on the preview engine regardless of this setting.
The engine version requested by the user. Possible values are determined by the output of ListEngineVersions , including Auto. The default is Auto.
Read only. The engine version on which the query runs. If the user requests a valid engine version other than Auto, the effective engine version is the same as the engine version that the user requested. If the user requests Auto, the effective engine version is chosen by Athena. When a request to update the engine version is made by a CreateWorkGroup or UpdateWorkGroup operation, the EffectiveEngineVersion field is ignored.
dict
Response Syntax
{}
Response Structure
Exceptions
The available paginators are:
paginator = client.get_paginator('get_query_results')
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'
}
)
[REQUIRED]
The unique ID of the query execution.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'UpdateCount': 123,
'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
(dict) --
UpdateCount (integer) --
The number of rows inserted with a CREATE TABLE AS SELECT statement.
ResultSet (dict) --
The results of the query execution.
Rows (list) --
The rows in the table.
(dict) --
The rows that make up a query result table.
Data (list) --
The data that populates a row in a query result table.
(dict) --
A piece of data (a field in the table).
VarCharValue (string) --
The value of the datum.
ResultSetMetadata (dict) --
The metadata that describes the column structure and data types of a table of query results.
ColumnInfo (list) --
Information about the columns returned in a query result metadata.
(dict) --
Information about the columns in a query execution result.
CatalogName (string) --
The catalog to which the query results belong.
SchemaName (string) --
The schema name (database name) to which the query results belong.
TableName (string) --
The table name for the query results.
Name (string) --
The name of the column.
Label (string) --
A column label.
Type (string) --
The data type of the column.
Precision (integer) --
For DECIMAL data types, specifies the total number of digits, up to 38. For performance reasons, we recommend up to 18 digits.
Scale (integer) --
For DECIMAL data types, specifies the total number of digits in the fractional part of the value. Defaults to 0.
Nullable (string) --
Indicates the column's nullable status.
CaseSensitive (boolean) --
Indicates whether values in the column are case-sensitive.
paginator = client.get_paginator('list_data_catalogs')
Creates an iterator that will paginate through responses from Athena.Client.list_data_catalogs().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
{
'DataCatalogsSummary': [
{
'CatalogName': 'string',
'Type': 'LAMBDA'|'GLUE'|'HIVE'
},
],
}
Response Structure
A summary list of data catalogs.
The summary information for the data catalog, which includes its name and type.
The name of the data catalog. The catalog name is unique for the Amazon Web Services account and can use a maximum of 127 alphanumeric, underscore, at sign, or hyphen characters. The remainder of the length constraint of 256 is reserved for use by Athena.
The data catalog type.
paginator = client.get_paginator('list_databases')
Creates an iterator that will paginate through responses from Athena.Client.list_databases().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
CatalogName='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
[REQUIRED]
The name of the data catalog that contains the databases to return.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'DatabaseList': [
{
'Name': 'string',
'Description': 'string',
'Parameters': {
'string': 'string'
}
},
],
}
Response Structure
(dict) --
DatabaseList (list) --
A list of databases from a data catalog.
(dict) --
Contains metadata information for a database in a data catalog.
Name (string) --
The name of the database.
Description (string) --
An optional description of the database.
Parameters (dict) --
A set of custom key/value pairs.
paginator = client.get_paginator('list_named_queries')
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(
WorkGroup='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'NamedQueryIds': [
'string',
],
}
Response Structure
(dict) --
NamedQueryIds (list) --
The list of unique query IDs.
paginator = client.get_paginator('list_query_executions')
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(
WorkGroup='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'QueryExecutionIds': [
'string',
],
}
Response Structure
(dict) --
QueryExecutionIds (list) --
The unique IDs of each query execution as an array of strings.
paginator = client.get_paginator('list_table_metadata')
Creates an iterator that will paginate through responses from Athena.Client.list_table_metadata().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
CatalogName='string',
DatabaseName='string',
Expression='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
[REQUIRED]
The name of the data catalog for which table metadata should be returned.
[REQUIRED]
The name of the database for which table metadata should be returned.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'TableMetadataList': [
{
'Name': 'string',
'CreateTime': datetime(2015, 1, 1),
'LastAccessTime': datetime(2015, 1, 1),
'TableType': 'string',
'Columns': [
{
'Name': 'string',
'Type': 'string',
'Comment': 'string'
},
],
'PartitionKeys': [
{
'Name': 'string',
'Type': 'string',
'Comment': 'string'
},
],
'Parameters': {
'string': 'string'
}
},
],
}
Response Structure
(dict) --
TableMetadataList (list) --
A list of table metadata.
(dict) --
Contains metadata for a table.
Name (string) --
The name of the table.
CreateTime (datetime) --
The time that the table was created.
LastAccessTime (datetime) --
The last time the table was accessed.
TableType (string) --
The type of table. In Athena, only EXTERNAL_TABLE is supported.
Columns (list) --
A list of the columns in the table.
(dict) --
Contains metadata for a column in a table.
Name (string) --
The name of the column.
Type (string) --
The data type of the column.
Comment (string) --
Optional information about the column.
PartitionKeys (list) --
A list of the partition keys in the table.
(dict) --
Contains metadata for a column in a table.
Name (string) --
The name of the column.
Type (string) --
The data type of the column.
Comment (string) --
Optional information about the column.
Parameters (dict) --
A set of custom key/value pairs for table properties.
paginator = client.get_paginator('list_tags_for_resource')
Creates an iterator that will paginate through responses from Athena.Client.list_tags_for_resource().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
ResourceARN='string',
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
[REQUIRED]
Lists the tags for the resource with the specified ARN.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
],
}
Response Structure
(dict) --
Tags (list) --
The list of tags associated with the specified resource.
(dict) --
A label that you assign to a resource. In Athena, a resource can be a workgroup or data catalog. Each tag consists of a key and an optional value, both of which you define. For example, you can use tags to categorize Athena workgroups or data catalogs by purpose, owner, or environment. Use a consistent set of tag keys to make it easier to search and filter workgroups or data catalogs in your account. For best practices, see Tagging Best Practices . Tag keys can be from 1 to 128 UTF-8 Unicode characters, and tag values can be from 0 to 256 UTF-8 Unicode characters. Tags can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys and values are case-sensitive. Tag keys must be unique per resource. If you specify more than one tag, separate them by commas.
Key (string) --
A tag key. The tag key length is from 1 to 128 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys are case-sensitive and must be unique per resource.
Value (string) --
A tag value. The tag value length is from 0 to 256 Unicode characters in UTF-8. You can use letters and numbers representable in UTF-8, and the following characters: + - = . _ : / @. Tag values are case-sensitive.