Skip to content

Commit ec91d8a

Browse files
author
Harinath
committed
* Resource notfound Exception fix on resource level table scan
1 parent d38e46c commit ec91d8a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pydanticrud/backends/dynamodb.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,15 @@ def query(self, query_expr: Optional[Rule] = None, filter_expr: Optional[Rule] =
303303
"expression")
304304

305305
else:
306-
resp = table.scan(**params)
307-
308-
return [self._deserialize_record(rec) for rec in resp["Items"]]
306+
try:
307+
resp = table.scan(**params)
308+
except ClientError as e:
309+
if e.response["Error"]["Code"] == "ResourceNotFoundException":
310+
resp = None
311+
else:
312+
raise e
313+
314+
return [self._deserialize_record(rec) for rec in resp["Items"]] if resp else []
309315

310316
def get(self, key):
311317
_key = self._key_param_to_dict(key)

0 commit comments

Comments
 (0)