I am using the batch_get_item function from boto3 to get multiple items from a dynamodb table at the same time. My code looks like this:

dynamodb = boto3.resource("dynamodb")
values = [1,2]
results = dynamodb.batch_get_item(RequestItems={lyric_table: {'Keys': [{'id': val} for val in values]}})

However, I get the error: TypeError: can't pickle _thread.lock objects.

I tired reformatting the list values above and also tried different key values, but I always got the same error.

Any advice of how to fix this? Or some advice on how to get multiple items based on primary key some other way?

0 Answers