:doc:`Athena <../../athena>` / Client / get_table_metadata

******************
get_table_metadata
******************



.. py:method:: Athena.Client.get_table_metadata(**kwargs)

  

  Returns table metadata for the specified catalog, database, and table.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetTableMetadata>`_  


  **Request Syntax**
  ::

    response = client.get_table_metadata(
        CatalogName='string',
        DatabaseName='string',
        TableName='string',
        WorkGroup='string'
    )
    
  :type CatalogName: string
  :param CatalogName: **[REQUIRED]** 

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

    

  
  :type DatabaseName: string
  :param DatabaseName: **[REQUIRED]** 

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

    

  
  :type TableName: string
  :param TableName: **[REQUIRED]** 

    The name of the table for which metadata is returned.

    

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

    

  
  
  :rtype: 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**
  
  *   :py:class:`Athena.Client.exceptions.InternalServerException`

  
  *   :py:class:`Athena.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`Athena.Client.exceptions.MetadataException`

  