:doc:`Glue <../../glue>` / Client / get_databases

*************
get_databases
*************



.. py:method:: Glue.Client.get_databases(**kwargs)

  

  Retrieves all databases defined in a given Data Catalog.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/glue-2017-03-31/GetDatabases>`_  


  **Request Syntax**
  ::

    response = client.get_databases(
        CatalogId='string',
        NextToken='string',
        MaxResults=123,
        ResourceShareType='FOREIGN'|'ALL'|'FEDERATED',
        AttributesToGet=[
            'NAME'|'TARGET_DATABASE',
        ]
    )
    
  :type CatalogId: string
  :param CatalogId: 

    The ID of the Data Catalog from which to retrieve ``Databases``. If none is provided, the Amazon Web Services account ID is used by default.

    

  
  :type NextToken: string
  :param NextToken: 

    A continuation token, if this is a continuation call.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of databases to return in one response.

    

  
  :type ResourceShareType: string
  :param ResourceShareType: 

    Allows you to specify that you want to list the databases shared with your account. The allowable values are ``FEDERATED``, ``FOREIGN`` or ``ALL``.

     

    
    * If set to ``FEDERATED``, will list the federated databases (referencing an external entity) shared with your account.
     
    * If set to ``FOREIGN``, will list the databases shared with your account.
     
    * If set to ``ALL``, will list the databases shared with your account, as well as the databases in yor local account.
    

    

  
  :type AttributesToGet: list
  :param AttributesToGet: 

    Specifies the database fields returned by the ``GetDatabases`` call. This parameter doesn’t accept an empty list. The request must include the ``NAME``.

    

  
    - *(string) --* 

    

  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'DatabaseList': [
              {
                  'Name': 'string',
                  'Description': 'string',
                  'LocationUri': 'string',
                  'Parameters': {
                      'string': 'string'
                  },
                  'CreateTime': datetime(2015, 1, 1),
                  'CreateTableDefaultPermissions': [
                      {
                          'Principal': {
                              'DataLakePrincipalIdentifier': 'string'
                          },
                          'Permissions': [
                              'ALL'|'SELECT'|'ALTER'|'DROP'|'DELETE'|'INSERT'|'CREATE_DATABASE'|'CREATE_TABLE'|'DATA_LOCATION_ACCESS',
                          ]
                      },
                  ],
                  'TargetDatabase': {
                      'CatalogId': 'string',
                      'DatabaseName': 'string',
                      'Region': 'string'
                  },
                  'CatalogId': 'string',
                  'FederatedDatabase': {
                      'Identifier': 'string',
                      'ConnectionName': 'string',
                      'ConnectionType': 'string'
                  }
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **DatabaseList** *(list) --* 

        A list of ``Database`` objects from the specified catalog.

        
        

        - *(dict) --* 

          The ``Database`` object represents a logical grouping of tables that might reside in a Hive metastore or an RDBMS.

          
          

          - **Name** *(string) --* 

            The name of the database. For Hive compatibility, this is folded to lowercase when it is stored.

            
          

          - **Description** *(string) --* 

            A description of the database.

            
          

          - **LocationUri** *(string) --* 

            The location of the database (for example, an HDFS path).

            
          

          - **Parameters** *(dict) --* 

            These key-value pairs define parameters and properties of the database.

            
            

            - *(string) --* 
              

              - *(string) --* 
        
      
          

          - **CreateTime** *(datetime) --* 

            The time at which the metadata database was created in the catalog.

            
          

          - **CreateTableDefaultPermissions** *(list) --* 

            Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the normal course of Glue operations.

            
            

            - *(dict) --* 

              Permissions granted to a principal.

              
              

              - **Principal** *(dict) --* 

                The principal who is granted permissions.

                
                

                - **DataLakePrincipalIdentifier** *(string) --* 

                  An identifier for the Lake Formation principal.

                  
            
              

              - **Permissions** *(list) --* 

                The permissions that are granted to the principal.

                
                

                - *(string) --* 
            
          
        
          

          - **TargetDatabase** *(dict) --* 

            A ``DatabaseIdentifier`` structure that describes a target database for resource linking.

            
            

            - **CatalogId** *(string) --* 

              The ID of the Data Catalog in which the database resides.

              
            

            - **DatabaseName** *(string) --* 

              The name of the catalog database.

              
            

            - **Region** *(string) --* 

              Region of the target database.

              
        
          

          - **CatalogId** *(string) --* 

            The ID of the Data Catalog in which the database resides.

            
          

          - **FederatedDatabase** *(dict) --* 

            A ``FederatedDatabase`` structure that references an entity outside the Glue Data Catalog.

            
            

            - **Identifier** *(string) --* 

              A unique identifier for the federated database.

              
            

            - **ConnectionName** *(string) --* 

              The name of the connection to the external metastore.

              
            

            - **ConnectionType** *(string) --* 

              The type of connection used to access the federated database, such as JDBC, ODBC, or other supported connection protocols.

              
        
      
    
      

      - **NextToken** *(string) --* 

        A continuation token for paginating the returned list of tokens, returned if the current segment of the list is not the last.

        
  
  **Exceptions**
  
  *   :py:class:`Glue.Client.exceptions.InvalidInputException`

  
  *   :py:class:`Glue.Client.exceptions.InternalServiceException`

  
  *   :py:class:`Glue.Client.exceptions.OperationTimeoutException`

  
  *   :py:class:`Glue.Client.exceptions.GlueEncryptionException`

  
  *   :py:class:`Glue.Client.exceptions.EntityNotFoundException`

  
  *   :py:class:`Glue.Client.exceptions.FederationSourceException`

  
  *   :py:class:`Glue.Client.exceptions.FederationSourceRetryableException`

  