Amazon Athena

2021/03/05 - Amazon Athena - 5 new api methods

Changes  Adds APIs to create, list, update, and delete prepared SQL statements that have optional placeholder parameters. A prepared statement can use different values for these parameters each time it is run.

UpdatePreparedStatement (new) Link ¶

Updates a prepared statement.

See also: AWS API Documentation

Request Syntax

client.update_prepared_statement(
    StatementName='string',
    WorkGroup='string',
    QueryStatement='string',
    Description='string'
)
type StatementName

string

param StatementName

[REQUIRED]

The name of the prepared statement.

type WorkGroup

string

param WorkGroup

[REQUIRED]

The workgroup for the prepared statement.

type QueryStatement

string

param QueryStatement

[REQUIRED]

The query string for the prepared statement.

type Description

string

param Description

The description of the prepared statement.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

ListPreparedStatements (new) Link ¶

Lists the prepared statements in the specfied workgroup.

See also: AWS API Documentation

Request Syntax

client.list_prepared_statements(
    WorkGroup='string',
    NextToken='string',
    MaxResults=123
)
type WorkGroup

string

param WorkGroup

[REQUIRED]

The workgroup to list the prepared statements for.

type NextToken

string

param NextToken

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.

type MaxResults

integer

param MaxResults

The maximum number of results to return in this request.

rtype

dict

returns

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.

CreatePreparedStatement (new) Link ¶

Creates a prepared statement for use with SQL queries in Athena.

See also: AWS API Documentation

Request Syntax

client.create_prepared_statement(
    StatementName='string',
    WorkGroup='string',
    QueryStatement='string',
    Description='string'
)
type StatementName

string

param StatementName

[REQUIRED]

The name of the prepared statement.

type WorkGroup

string

param WorkGroup

[REQUIRED]

The name of the workgroup to which the prepared statement belongs.

type QueryStatement

string

param QueryStatement

[REQUIRED]

The query string for the prepared statement.

type Description

string

param Description

The description of the prepared statement.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

DeletePreparedStatement (new) Link ¶

Deletes the prepared statement with the specified name from the specified workgroup.

See also: AWS API Documentation

Request Syntax

client.delete_prepared_statement(
    StatementName='string',
    WorkGroup='string'
)
type StatementName

string

param StatementName

[REQUIRED]

The name of the prepared statement to delete.

type WorkGroup

string

param WorkGroup

[REQUIRED]

The workgroup to which the statement to be deleted belongs.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

GetPreparedStatement (new) Link ¶

Retrieves the prepared statement with the specified name from the specified workgroup.

See also: AWS API Documentation

Request Syntax

client.get_prepared_statement(
    StatementName='string',
    WorkGroup='string'
)
type StatementName

string

param StatementName

[REQUIRED]

The name of the prepared statement to retrieve.

type WorkGroup

string

param WorkGroup

[REQUIRED]

The workgroup to which the statement to be retrieved belongs.

rtype

dict

returns

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.