Allow spaces to if_not_exists
This commit is contained in:
parent
dfa7935e13
commit
2c15d71c2c
@ -154,7 +154,7 @@ class Item(BaseModel):
|
|||||||
# If not exists, changes value to a default if needed, else its the same as it was
|
# If not exists, changes value to a default if needed, else its the same as it was
|
||||||
if value.startswith('if_not_exists'):
|
if value.startswith('if_not_exists'):
|
||||||
# Function signature
|
# Function signature
|
||||||
match = re.match(r'.*if_not_exists\((?P<path>.+),\s*(?P<default>.+)\).*', value)
|
match = re.match(r'.*if_not_exists\s*\((?P<path>.+),\s*(?P<default>.+)\).*', value)
|
||||||
if not match:
|
if not match:
|
||||||
raise TypeError
|
raise TypeError
|
||||||
|
|
||||||
|
@ -1220,6 +1220,7 @@ def test_update_if_not_exists():
|
|||||||
'forum_name': 'the-key',
|
'forum_name': 'the-key',
|
||||||
'subject': '123'
|
'subject': '123'
|
||||||
},
|
},
|
||||||
|
# if_not_exists without space
|
||||||
UpdateExpression='SET created_at=if_not_exists(created_at,:created_at)',
|
UpdateExpression='SET created_at=if_not_exists(created_at,:created_at)',
|
||||||
ExpressionAttributeValues={
|
ExpressionAttributeValues={
|
||||||
':created_at': 123
|
':created_at': 123
|
||||||
@ -1233,6 +1234,7 @@ def test_update_if_not_exists():
|
|||||||
'forum_name': 'the-key',
|
'forum_name': 'the-key',
|
||||||
'subject': '123'
|
'subject': '123'
|
||||||
},
|
},
|
||||||
|
# if_not_exists with space
|
||||||
UpdateExpression='SET created_at = if_not_exists (created_at, :created_at)',
|
UpdateExpression='SET created_at = if_not_exists (created_at, :created_at)',
|
||||||
ExpressionAttributeValues={
|
ExpressionAttributeValues={
|
||||||
':created_at': 456
|
':created_at': 456
|
||||||
|
Loading…
Reference in New Issue
Block a user