Skip to content

Commit 07ed678

Browse files
committed
[NRL-1606] Fix case where custodians param is not a tuple
1 parent d8b0a0e commit 07ed678

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

reports/get_pointer_masterids_for_custodian.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,25 @@
99
paginator = dynamodb.get_paginator("scan")
1010

1111

12-
def _get_masterids_for_custodians(table_name: str, custodians: str) -> Any:
12+
def _get_masterids_for_custodians(table_name: str, custodians: str | tuple[str]) -> Any:
1313
"""
1414
Get masterids for pointers in the given table for a list of custodians.
1515
Parameters:
1616
- table_name: The name of the pointers table to use.
1717
"""
18+
custodian_list = (
19+
custodians.split(",") if isinstance(custodians, str) else list(custodians)
20+
)
1821

1922
print( # noqa
20-
f"Getting masterids for custodians {custodians} in table {table_name}...."
23+
f"Getting masterids for custodians {custodian_list} in table {table_name}...."
2124
)
2225

23-
expression_names_str = ",".join([f":param_{custodian}" for custodian in custodians])
26+
expression_names_str = ",".join(
27+
[f":param{custodian}" for custodian in custodian_list]
28+
)
2429
expression_values_list = {
25-
f":param_{custodian}": {"S": custodian} for custodian in custodians
30+
f":param{custodian}": {"S": custodian} for custodian in custodian_list
2631
}
2732

2833
params: dict[str, Any] = {

0 commit comments

Comments
 (0)