def UploadCSV()

in bulkprovision/bulkexecute/__init__.py [0:0]


    def UploadCSV(self):
        '''
        uploads data from the given csv to dynamo with an initial status of NEW
        '''
        # get the csv file
        csv_bucket = self.get_config_value("csvbucket")
        csv_key = self.get_config_value("csvkey")        
        BatchId = self.get_config_value("BatchId")
        input_dict = self.s3_get_csvasdict(csv_bucket, csv_key)    
        
        # build the dynamo object
        arr = [ ]
        for item in input_dict:
            if BatchId is not None:
                item["BatchId"] = BatchId
            obj={
                "guidkey": str(uuid.uuid4()),
                "status": "NEW" ,                
                "launchparams": item
            }
            arr.append(obj)
        count = len(arr)
        # upload this to the dynamo table
        self.dynamo_write_batch(arr)
        logger.info("Loaded {} new entries to {}".format(count, self.getDynamoTableName()))
        return(self.generate_return(count))