mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-07 07:23:15 +00:00
alternator-test: test UpdateItem's SET with #reference
Test an operation like SET #one = #two, where the RHS has a reference to a name, rather than the name itself. Also verify that DynamoDB gives an error if ExpressionAttributeNames includes names not needed by neither left or right hand side of such assignments. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20190708133311.11843-1-nyh@scylladb.com>
This commit is contained in:
@@ -53,6 +53,15 @@ def test_update_expression_set_copy(test_table_s):
|
||||
assert test_table_s.get_item(Key={'p': p}, ConsistentRead=True)['Item'] == {'p': p, 'a': 'hello', 'b': 'hello'}
|
||||
with pytest.raises(ClientError, match='ValidationException'):
|
||||
test_table_s.update_item(Key={'p': p}, UpdateExpression='SET z = z')
|
||||
# We can also use name references in either LHS or RHS of SET, e.g.,
|
||||
# SET #one = #two. We need to also take the references used in the RHS
|
||||
# when we want to complain about unused names in ExpressionAttributeNames.
|
||||
test_table_s.update_item(Key={'p': p}, UpdateExpression='SET #one = #two',
|
||||
ExpressionAttributeNames={'#one': 'c', '#two': 'a'})
|
||||
assert test_table_s.get_item(Key={'p': p}, ConsistentRead=True)['Item'] == {'p': p, 'a': 'hello', 'b': 'hello', 'c': 'hello'}
|
||||
with pytest.raises(ClientError, match='ValidationException'):
|
||||
test_table_s.update_item(Key={'p': p}, UpdateExpression='SET #one = #two',
|
||||
ExpressionAttributeNames={'#one': 'c', '#two': 'a', '#three': 'z'})
|
||||
|
||||
# Test for read-before-write action where the value to be read is nested inside a - operator
|
||||
def test_update_expression_set_nested_copy(test_table_s):
|
||||
|
||||
Reference in New Issue
Block a user