aws.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:donatemates 作者: donatemates 项目源码 文件源码
def scan_table(self, eval_function, result_dict, attribute_str):
        """Method to scan a table, passing each item into an evaluation function

        Args:
            eval_function (function): Function to process the items
            attribute_str (str): Comma separated string of attributes to get

        Returns:
            (dict) Result of the scan
        """
        client = boto3.client('dynamodb', region_name="us-east-1")
        paginator = client.get_paginator('scan')
        params = {"ProjectionExpression": attribute_str,
                  "TableName": self.table_name,
                  "PaginationConfig": {'PageSize': 500}
                  }

        response_iterator = paginator.paginate(**params)
        for page in response_iterator:
            result_dict = eval_function(page["Items"], result_dict)

        return result_dict
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号