def main(param): try: # s3 url access s3conn = aws.s3conn() s3bucket = aws.get_bucket(s3conn, config.get('s3', 'p_refined_data_bucket')) rdsconn = aws.rdsconn(config) getsql = "select maker_id, data_type, data_date, status, msg from data_ctrl_mst where maker_id = %s and data_type = '%s' and data_date = '%s' and status = 'refine' and msg is not null; " % (param.maker_id, param.data_type, param.data_date) res = aws.fetch_sql(rdsconn, getsql) if len(res) == 1: process_data(s3bucket, rdsconn, res[0]) else: raise ValueError('抽出ファイルエラー sq:{0}'.format(getsql)) except Exception as e: log.except_log(logger, e)
def test_get_bucket(self): conn = aws.s3conn() actual = aws.get_bucket(conn,self.bucket_name) assert actual.name == self.bucket_name