def grant_db_describe()

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


def grant_db_describe(principal, database):

    """  Grants 'DESCRIBE' on database to the Principal 
    Arguments: 
        principal {str} -- Principal to which DB describe is needed
        database  {str} -- Database Name   
    
    Returns:
        response {dict} -- response from Lakeformation API call
    """    

    Name = database
    permissions = ['DESCRIBE'] 
    database_json = {}

    Database = {
        'Name': database
    }
    database_json['Database'] = Database
    client = boto3.client('lakeformation', config=Config(connect_timeout=5, read_timeout=60, retries={'max_attempts': 20}))
    logger.info('Granting DB Describe on resource {} for Principal {}'
                        .format(principal, database ))
    response= client.grant_permissions(Principal=principal,
                            Resource=database_json,
                            Permissions=permissions)
    logger.info('DB DESCRIBE Grant Response {}'.format(response))
    return response