Skip to content

Instantly share code, notes, and snippets.

@dineshviswanath
Last active December 19, 2019 15:08
Show Gist options
  • Save dineshviswanath/f578ccf0eaa3cc50511e5082a83f1eda to your computer and use it in GitHub Desktop.
Save dineshviswanath/f578ccf0eaa3cc50511e5082a83f1eda to your computer and use it in GitHub Desktop.
batch insert DynamoDB
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