Amazon Athena

2023/04/28 - Amazon Athena - 7 new api methods

Changes  You can now use capacity reservations on Amazon Athena to run SQL queries on fully-managed compute capacity.

PutCapacityAssignmentConfiguration (new) Link ¶

Puts a new capacity assignment configuration for a specified capacity reservation. If a capacity assignment configuration already exists for the capacity reservation, replaces the existing capacity assignment configuration.

See also: AWS API Documentation

Request Syntax

client.put_capacity_assignment_configuration(
    CapacityReservationName='string',
    CapacityAssignments=[
        {
            'WorkGroupNames': [
                'string',
            ]
        },
    ]
)
type CapacityReservationName:

string

param CapacityReservationName:

[REQUIRED]

The name of the capacity reservation to put a capacity assignment configuration for.

type CapacityAssignments:

list

param CapacityAssignments:

[REQUIRED]

The list of assignments for the capacity assignment configuration.

  • (dict) --

    A mapping between one or more workgroups and a capacity reservation.

    • WorkGroupNames (list) --

      The list of workgroup names for the capacity assignment.

      • (string) --

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

GetCapacityReservation (new) Link ¶

Returns information about the capacity reservation with the specified name.

See also: AWS API Documentation

Request Syntax

client.get_capacity_reservation(
    Name='string'
)
type Name:

string

param Name:

[REQUIRED]

The name of the capacity reservation.

rtype:

dict

returns:

Response Syntax

{
    'CapacityReservation': {
        'Name': 'string',
        'Status': 'PENDING'|'ACTIVE'|'CANCELLING'|'CANCELLED'|'FAILED'|'UPDATE_PENDING',
        'TargetDpus': 123,
        'AllocatedDpus': 123,
        'LastAllocation': {
            'Status': 'PENDING'|'SUCCEEDED'|'FAILED',
            'StatusMessage': 'string',
            'RequestTime': datetime(2015, 1, 1),
            'RequestCompletionTime': datetime(2015, 1, 1)
        },
        'LastSuccessfulAllocationTime': datetime(2015, 1, 1),
        'CreationTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • CapacityReservation (dict) --

      The requested capacity reservation structure.

      • Name (string) --

        The name of the capacity reservation.

      • Status (string) --

        The status of the capacity reservation.

      • TargetDpus (integer) --

        The number of data processing units requested.

      • AllocatedDpus (integer) --

        The number of data processing units currently allocated.

      • LastAllocation (dict) --

        Contains the submission time of a single allocation request for a capacity reservation and the most recent status of the attempted allocation.

        • Status (string) --

          The status of the capacity allocation.

        • StatusMessage (string) --

          The status message of the capacity allocation.

        • RequestTime (datetime) --

          The time when the capacity allocation was requested.

        • RequestCompletionTime (datetime) --

          The time when the capacity allocation request was completed.

      • LastSuccessfulAllocationTime (datetime) --

        The time of the most recent capacity allocation that succeeded.

      • CreationTime (datetime) --

        The time in UTC epoch millis when the capacity reservation was created.

CancelCapacityReservation (new) Link ¶

Cancels the capacity reservation with the specified name.

See also: AWS API Documentation

Request Syntax

client.cancel_capacity_reservation(
    Name='string'
)
type Name:

string

param Name:

[REQUIRED]

The name of the capacity reservation to cancel.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

ListCapacityReservations (new) Link ¶

Lists the capacity reservations for the current account.

See also: AWS API Documentation

Request Syntax

client.list_capacity_reservations(
    NextToken='string',
    MaxResults=123
)
type NextToken:

string

param NextToken:

A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated.

type MaxResults:

integer

param MaxResults:

Specifies the maximum number of results to return.

rtype:

dict

returns:

Response Syntax

{
    'NextToken': 'string',
    'CapacityReservations': [
        {
            'Name': 'string',
            'Status': 'PENDING'|'ACTIVE'|'CANCELLING'|'CANCELLED'|'FAILED'|'UPDATE_PENDING',
            'TargetDpus': 123,
            'AllocatedDpus': 123,
            'LastAllocation': {
                'Status': 'PENDING'|'SUCCEEDED'|'FAILED',
                'StatusMessage': 'string',
                'RequestTime': datetime(2015, 1, 1),
                'RequestCompletionTime': datetime(2015, 1, 1)
            },
            'LastSuccessfulAllocationTime': datetime(2015, 1, 1),
            'CreationTime': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) --

    • 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.

    • CapacityReservations (list) --

      The capacity reservations for the current account.

      • (dict) --

        A reservation for a specified number of data processing units (DPUs). When a reservation is initially created, it has no DPUs. Athena allocates DPUs until the allocated amount equals the requested amount.

        • Name (string) --

          The name of the capacity reservation.

        • Status (string) --

          The status of the capacity reservation.

        • TargetDpus (integer) --

          The number of data processing units requested.

        • AllocatedDpus (integer) --

          The number of data processing units currently allocated.

        • LastAllocation (dict) --

          Contains the submission time of a single allocation request for a capacity reservation and the most recent status of the attempted allocation.

          • Status (string) --

            The status of the capacity allocation.

          • StatusMessage (string) --

            The status message of the capacity allocation.

          • RequestTime (datetime) --

            The time when the capacity allocation was requested.

          • RequestCompletionTime (datetime) --

            The time when the capacity allocation request was completed.

        • LastSuccessfulAllocationTime (datetime) --

          The time of the most recent capacity allocation that succeeded.

        • CreationTime (datetime) --

          The time in UTC epoch millis when the capacity reservation was created.

UpdateCapacityReservation (new) Link ¶

Updates the number of requested data processing units for the capacity reservation with the specified name.

See also: AWS API Documentation

Request Syntax

client.update_capacity_reservation(
    TargetDpus=123,
    Name='string'
)
type TargetDpus:

integer

param TargetDpus:

[REQUIRED]

The new number of requested data processing units.

type Name:

string

param Name:

[REQUIRED]

The name of the capacity reservation.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

CreateCapacityReservation (new) Link ¶

Creates a capacity reservation with the specified name and number of requested data processing units.

See also: AWS API Documentation

Request Syntax

client.create_capacity_reservation(
    TargetDpus=123,
    Name='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type TargetDpus:

integer

param TargetDpus:

[REQUIRED]

The number of requested data processing units.

type Name:

string

param Name:

[REQUIRED]

The name of the capacity reservation to create.

type Tags:

list

param Tags:

The tags for the capacity reservation.

  • (dict) --

    A label that you assign to a resource. Athena resources include workgroups, data catalogs, and capacity reservations. Each tag consists of a key and an optional value, both of which you define. For example, you can use tags to categorize Athena resources by purpose, owner, or environment. Use a consistent set of tag keys to make it easier to search and filter the resources 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.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

GetCapacityAssignmentConfiguration (new) Link ¶

Gets the capacity assignment configuration for a capacity reservation, if one exists.

See also: AWS API Documentation

Request Syntax

client.get_capacity_assignment_configuration(
    CapacityReservationName='string'
)
type CapacityReservationName:

string

param CapacityReservationName:

[REQUIRED]

The name of the capacity reservation to retrieve the capacity assignment configuration for.

rtype:

dict

returns:

Response Syntax

{
    'CapacityAssignmentConfiguration': {
        'CapacityReservationName': 'string',
        'CapacityAssignments': [
            {
                'WorkGroupNames': [
                    'string',
                ]
            },
        ]
    }
}

Response Structure

  • (dict) --

    • CapacityAssignmentConfiguration (dict) --

      The requested capacity assignment configuration for the specified capacity reservation.

      • CapacityReservationName (string) --

        The name of the reservation that the capacity assignment configuration is for.

      • CapacityAssignments (list) --

        The list of assignments that make up the capacity assignment configuration.

        • (dict) --

          A mapping between one or more workgroups and a capacity reservation.

          • WorkGroupNames (list) --

            The list of workgroup names for the capacity assignment.

            • (string) --