Amazon Athena

2026/11/16 - Amazon Athena - 2 updated api methods

Changes  Adds an optional AttributesToGet parameter to ListDatabases and ListTableMetadata to return only requested database or table names (and table types) from the AWS Glue Data Catalog, reducing response time for large catalogs.

ListDatabases (updated) Link ¶
Changes (request)
{'AttributesToGet': ['NAME']}

Lists the databases in the specified data catalog.

See also: AWS API Documentation

Request Syntax

client.list_databases(
    CatalogName='string',
    NextToken='string',
    MaxResults=123,
    WorkGroup='string',
    AttributesToGet=[
        'NAME',
    ]
)
type CatalogName:

string

param CatalogName:

[REQUIRED]

The name of the data catalog that contains the databases to return.

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:

Specifies the maximum number of results to return.

type WorkGroup:

string

param WorkGroup:

The name of the workgroup for which the metadata is being fetched. Required if requesting an IAM Identity Center enabled Glue Data Catalog.

type AttributesToGet:

list

param AttributesToGet:

Specifies the database properties returned by the ListDatabases call. The only valid value is NAME, which returns only the name of each database and omits the remaining properties. If you omit this parameter or specify an empty list, all database properties are returned.

Requesting only names can reduce response time for catalogs that contain many databases, especially resource links to databases shared from other accounts.

This parameter applies only to the Glue Data Catalog. For other data catalog types, it is ignored.

  • (string) --

    A database property that can be requested in the AttributesToGet parameter of ListDatabases.

rtype:

dict

returns:

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.

          • (string) --

            • (string) --

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

ListTableMetadata (updated) Link ¶
Changes (request)
{'AttributesToGet': ['NAME | TABLE_TYPE']}

Lists the metadata for the tables in the specified data catalog database.

See also: AWS API Documentation

Request Syntax

client.list_table_metadata(
    CatalogName='string',
    DatabaseName='string',
    Expression='string',
    NextToken='string',
    MaxResults=123,
    WorkGroup='string',
    AttributesToGet=[
        'NAME'|'TABLE_TYPE',
    ]
)
type CatalogName:

string

param CatalogName:

[REQUIRED]

The name of the data catalog for which table metadata should be returned.

type DatabaseName:

string

param DatabaseName:

[REQUIRED]

The name of the database for which table metadata should be returned.

type Expression:

string

param Expression:

A regex filter that pattern-matches table names. If no expression is supplied, metadata for all tables are listed.

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:

Specifies the maximum number of results to return.

type WorkGroup:

string

param WorkGroup:

The name of the workgroup for which the metadata is being fetched. Required if requesting an IAM Identity Center enabled Glue Data Catalog.

type AttributesToGet:

list

param AttributesToGet:

Specifies the table properties returned by the ListTableMetadata call. This parameter doesn't accept an empty list, and the request must include NAME. The valid combinations of values are NAME, which returns the name of each table, and NAME and TABLE_TYPE, which return the name and table type of each table. The remaining properties are omitted. If you omit this parameter, all table properties are returned.

Requesting only the properties you need can reduce response time for databases that contain many tables.

This parameter applies only to the Glue Data Catalog. For other data catalog types, it is ignored.

  • (string) --

    A table property that can be requested in the AttributesToGet parameter of ListTableMetadata.

rtype:

dict

returns:

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.

          • (string) --

            • (string) --

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