def check_db_exist()

in src/lakeformation_permissions/consumption/lambda_function.py [0:0]


def check_db_exist(glue_client, database):
    """
    Check if Database exist on consumption

    Arguments:
          glue_client -- glue client object
          database  {str}  -- database Name
    
    Returns - 
        True/False {bool}
    """
    try:
        response = glue_client.get_database(Name=database)
        return True
    except glue_client.exceptions.EntityNotFoundException: 
        return False
    except Exception as e: 
        ErrorMessage = str(e)
        logger.info("Exception occured while checking for DB existance - {}".format(ErrorMessage))            
        raise e