Skip to content

Commit 3cc91ad

Browse files
author
Lucas McDonald
committed
m
1 parent ce4f1e9 commit 3cc91ad

File tree

2 files changed

+11
-3
lines changed
  • DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb
  • Examples/runtimes/python/DynamoDBEncryption/src/searchable_encryption/complex_example/client

2 files changed

+11
-3
lines changed

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
try:
3939
old_traps = old_context.__getattribute__("traps")
4040
except AttributeError:
41-
raise AttributeError("boto3.dynamodb.types.DYNAMODB_CONTEXT must have a 'traps' attribute to use DBESDK for DynamoDB.")
41+
raise AttributeError(
42+
"boto3.dynamodb.types.DYNAMODB_CONTEXT must have a 'traps' attribute to use DBESDK for DynamoDB."
43+
)
4244

4345
# traps structure: {k (trap class) : v (True if trap should raise Exception; False otherwise)}
4446
old_traps[Rounded] = False

Examples/runtimes/python/DynamoDBEncryption/src/searchable_encryption/complex_example/client/query_requests.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
"""Run all queries on the EncryptedClient."""
4+
import time
45

56

67
def run_queries(ddb_client, table_name):
@@ -477,6 +478,9 @@ def run_query_14(ddb_client, table_name):
477478
478479
Key condition: PK3=city SK3 begins_with(building.floor.desk).
479480
"""
481+
# GSIs do not update instantly
482+
# so if the results come back empty
483+
# we retry after a short sleep
480484
for i in range(10):
481485
response = ddb_client.query(
482486
TableName=table_name,
@@ -500,8 +504,10 @@ def run_query_14(ddb_client, table_name):
500504
assert item["EmployeeID"]["S"] == "emp_001"
501505
assert item["Location"]["M"]["Desk"]["S"] == "3"
502506

503-
assert found_known_value_item
504-
break
507+
if found_known_value_item:
508+
break
509+
510+
time.sleep(1)
505511

506512
# Assert the value was found inside the loop
507513
assert found_known_value_item

0 commit comments

Comments
 (0)