Skip to content

Commit 9270d73

Browse files
author
Lucas McDonald
committed
sync
1 parent a9da8b2 commit 9270d73

File tree

7 files changed

+22
-12
lines changed

7 files changed

+22
-12
lines changed

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/internal/client_to_resource.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ def condition_handler(self, expression_key, request):
2828
condition = request[expression_key]
2929

3030
# This conversion in client_to_resource does not update ExpressionAttributeNames or ExpressionAttributeValues.
31-
# However, resource_to_client condition_handler may add new ExpressionAttributeNames and ExpressionAttributeValues.
32-
# Smithy-generated code expects condition_handlers to return ExpressionAttributeNames and ExpressionAttributeValues,
31+
# However, resource_to_client condition_handler may add new ExpressionAttributeNames and
32+
# ExpressionAttributeValues.
33+
# Smithy-generated code expects condition_handlers to return ExpressionAttributeNames and
34+
# ExpressionAttributeValues,
3335
# expecting empty dicts if there are none.
3436
try:
3537
names = request["ExpressionAttributeNames"]
@@ -88,7 +90,7 @@ def delete_item_request(self, delete_item_request):
8890
if self.delete_table_name:
8991
del out["TableName"]
9092
return out
91-
93+
9294
def delete_item_response(self, delete_item_response):
9395
return self.boto3_converter.DeleteItemOutput(delete_item_response)
9496

@@ -98,7 +100,7 @@ def update_item_request(self, update_item_request):
98100
if self.delete_table_name:
99101
del out["TableName"]
100102
return out
101-
103+
102104
def update_item_response(self, update_item_response):
103105
return self.boto3_converter.UpdateItemOutput(update_item_response)
104106

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/internal/resource_to_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from aws_cryptography_internal_dynamodb.smithygenerated.com_amazonaws_dynamodb.boto3_conversions import (
44
InternalBoto3DynamoDBFormatConverter,
55
)
6-
from boto3.dynamodb.types import TypeSerializer
76
from boto3.dynamodb.conditions import ConditionExpressionBuilder
7+
from boto3.dynamodb.types import TypeSerializer
88

99

1010
class ResourceShapeToClientShapeConverter:
@@ -43,10 +43,12 @@ def condition_handler(self, expression_key, request):
4343
hasattr(condition_expression, "__module__")
4444
and condition_expression.__module__ == "boto3.dynamodb.conditions"
4545
):
46-
built_condition_expression = self.expression_builder.build_expression(
47-
condition_expression
46+
built_condition_expression = self.expression_builder.build_expression(condition_expression)
47+
return (
48+
built_condition_expression.condition_expression,
49+
built_condition_expression.attribute_name_placeholders,
50+
built_condition_expression.attribute_value_placeholders,
4851
)
49-
return built_condition_expression.condition_expression, built_condition_expression.attribute_name_placeholders, built_condition_expression.attribute_value_placeholders
5052
else:
5153
return condition_expression, existing_expression_attribute_names, existing_expression_attribute_values
5254

DynamoDbEncryption/runtimes/python/test/items.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
13
from decimal import Decimal
24

35
simple_item_ddb = {

DynamoDbEncryption/runtimes/python/test/requests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
13
"""Request constants for DynamoDB operations used for testing."""
24

35
from boto3.dynamodb.conditions import Attr, Key
@@ -140,7 +142,7 @@ def basic_batch_execute_statement_request_plaintext_table():
140142

141143
# No exhaustive requests are intended to be able to be used as real requests.
142144
# Some parameters conflict with each other when sent to DynamoDB.
143-
# These are only intended to test the conversion of the request from client to resource format.
145+
# These are only intended to test the conversion of the structure from client to resource format.
144146

145147

146148
def base_exhaustive_put_item_request(item):

DynamoDbEncryption/runtimes/python/test/responses.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
13
from test.integ.encrypted.test_resource import INTEG_TEST_DEFAULT_DYNAMODB_TABLE_NAME
24

35

DynamoDbEncryption/runtimes/python/test/unit/internal/test_client_to_resource.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55
from aws_dbesdk_dynamodb.internal.client_to_resource import ClientShapeToResourceShapeConverter
6-
from aws_dbesdk_dynamodb.internal.condition_expression_builder import InternalDBESDKDynamoDBConditionExpressionBuilder
6+
from boto3.dynamodb.conditions import ConditionExpressionBuilder
77

88
from ...items import (
99
complex_item_ddb,
@@ -261,7 +261,7 @@ def get_string_for_key_condition_expression(
261261
):
262262
"""Get the string for the key condition expression."""
263263
if not isinstance(key_condition_expression, str):
264-
built_expression = InternalDBESDKDynamoDBConditionExpressionBuilder().build_expression(
264+
built_expression = ConditionExpressionBuilder().build_expression(
265265
key_condition_expression, expression_attribute_names, expression_attribute_values
266266
)
267267
key_condition_expression = built_expression.condition_expression

DynamoDbEncryption/runtimes/python/test/unit/internal/test_resource_to_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
import pytest
4-
54
from boto3.dynamodb.conditions import ConditionExpressionBuilder
5+
66
from aws_dbesdk_dynamodb.internal.resource_to_client import ResourceShapeToClientShapeConverter
77

88
from ...constants import INTEG_TEST_DEFAULT_DYNAMODB_TABLE_NAME

0 commit comments

Comments
 (0)