dynamodb2 was evaluating ProjectionExpression on the wrong local result set
This commit is contained in:
parent
06492026c3
commit
64fb0207e2
@ -493,7 +493,8 @@ class Table(BaseModel):
|
|||||||
|
|
||||||
if projection_expression:
|
if projection_expression:
|
||||||
expressions = [x.strip() for x in projection_expression.split(',')]
|
expressions = [x.strip() for x in projection_expression.split(',')]
|
||||||
for result in copy.deepcopy(possible_results):
|
results = copy.deepcopy(results)
|
||||||
|
for result in results:
|
||||||
for attr in list(result.attrs):
|
for attr in list(result.attrs):
|
||||||
if attr not in expressions:
|
if attr not in expressions:
|
||||||
result.attrs.pop(attr)
|
result.attrs.pop(attr)
|
||||||
|
@ -367,8 +367,10 @@ def test_basic_projection_expressions():
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert 'body' in results['Items'][0]
|
assert 'body' in results['Items'][0]
|
||||||
|
assert 'subject' not in results['Items'][0]
|
||||||
assert results['Items'][0]['body'] == 'some test message'
|
assert results['Items'][0]['body'] == 'some test message'
|
||||||
assert 'body' in results['Items'][1]
|
assert 'body' in results['Items'][1]
|
||||||
|
assert 'subject' not in results['Items'][1]
|
||||||
assert results['Items'][1]['body'] == 'yet another test message'
|
assert results['Items'][1]['body'] == 'yet another test message'
|
||||||
|
|
||||||
# The projection expression should not remove data from storage
|
# The projection expression should not remove data from storage
|
||||||
|
Loading…
Reference in New Issue
Block a user