Last active
December 19, 2019 15:08
-
-
Save dineshviswanath/f578ccf0eaa3cc50511e5082a83f1eda to your computer and use it in GitHub Desktop.
Revisions
-
dineshviswanath revised this gist
Dec 19, 2019 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,11 +5,11 @@ def dynamo_db_batch_write(items): dynamo_db = boto3.resource( 'dynamodb', endpoint_url=get_aws_endpoint_url('dynamodb'), region_name=region, ) table = dynamo_db.Table(table) with table.batch_writer() as batch: for item in items: batch.put_item(Item=item)
-
dineshviswanath created this gist
Dec 19, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ def dynamo_db_batch_write(items): """ Write in db by batch """ dynamo_db = boto3.resource( 'dynamodb', endpoint_url=get_aws_endpoint_url('dynamodb'), region_name=EOC_DYNAMO_DB_REGION, ) table = dynamo_db.Table(EOC_DYNAMO_DB_NAME) with table.batch_writer() as batch: for item in items: batch.put_item(Item=item) logging.info('Batch insert done for {} records'.format(len(items)))