Athena / Client / get_table_metadata

get_table_metadata#

Athena.Client.get_table_metadata(**kwargs)#

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',
    WorkGroup='string'
)
Parameters:
  • CatalogName (string) –

    [REQUIRED]

    The name of the data catalog that contains the database and table metadata to return.

  • DatabaseName (string) –

    [REQUIRED]

    The name of the database that contains the table metadata to return.

  • TableName (string) –

    [REQUIRED]

    The name of the table for which metadata is returned.

  • WorkGroup (string) – The name of the workgroup for which the metadata is being fetched. Required if requesting an IAM Identity Center enabled Glue Data Catalog.

Return type:

dict

Returns:

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.

        • (string) –

          • (string) –

Exceptions