Last active
December 19, 2019 15:08
-
-
Save dineshviswanath/f578ccf0eaa3cc50511e5082a83f1eda to your computer and use it in GitHub Desktop.
batch insert DynamoDB
This file contains 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 characters
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=region, | |
) | |
table = dynamo_db.Table(table) | |
with table.batch_writer() as batch: | |
for item in items: | |
batch.put_item(Item=item) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment