Merge pull request #1334 from reinecke/fix/dynamo_projection_mutation

dynamodb2: Fix for ProjectionExpressions changing the data in storage
This commit is contained in:
Jack Danger 2017-11-12 08:05:33 -08:00 committed by GitHub
commit 068417b1f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -1,5 +1,6 @@
from __future__ import unicode_literals
from collections import defaultdict
import copy
import datetime
import decimal
import json
@ -492,7 +493,8 @@ class Table(BaseModel):
if projection_expression:
expressions = [x.strip() for x in projection_expression.split(',')]
for result in possible_results:
results = copy.deepcopy(results)
for result in results:
for attr in list(result.attrs):
if attr not in expressions:
result.attrs.pop(attr)