Skip to content

Commit 2eb06ed

Browse files
committed
fix string limit pagination
1 parent d660f99 commit 2eb06ed

3 files changed

Lines changed: 9 additions & 35 deletions

File tree

sdks/python/apache_beam/io/gcp/healthcare/dicomclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def qido_search(
6565
page_size = 500
6666

6767
if params and 'limit' in params:
68-
page_size = params['limit']
68+
page_size = int(params['limit'])
6969
elif params:
7070
params['limit'] = page_size
7171
else:

sdks/python/apache_beam/yaml/extended_tests/databases/dicom.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,3 @@ pipelines:
4242
- {status: "200"}
4343
options:
4444
project: "apache-beam-testing"
45-
46-
- pipeline:
47-
type: chain
48-
transforms:
49-
- type: Create
50-
config:
51-
elements:
52-
- project_id: "apache-beam-testing"
53-
region: "us-central1"
54-
dataset_id: "apache-beam-integration-testing"
55-
dicom_store_id: "dicom_it_persistent_store"
56-
search_type: "instances"
57-
params:
58-
StudyInstanceUID: "study_000000001"
59-
- type: DicomSearch
60-
- type: MapToFields
61-
config:
62-
language: python
63-
fields:
64-
status: status
65-
- type: AssertEqual
66-
config:
67-
elements:
68-
- {status: "200"}
69-
options:
70-
project: "apache-beam-testing"

sdks/python/apache_beam/yaml/yaml_io.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,16 +1003,16 @@ def row_to_dict(value):
10031003
return value
10041004

10051005
def normalize_request(value):
1006-
# YAML Create often types params as map[str, str]; qido_search needs
1007-
# int limit/offset for pagination comparisons.
1006+
# YAML Create types params as map[str, str]; qido_search needs int
1007+
# limit/offset for pagination comparisons.
10081008
request = row_to_dict(value)
10091009
params = request.get('params')
1010-
if isinstance(params, Mapping):
1011-
params = dict(params)
1012-
for key in ('limit', 'offset'):
1013-
if key in params and params[key] is not None:
1014-
params[key] = int(params[key])
1015-
request['params'] = params
1010+
params = dict(params) if isinstance(params, Mapping) else {}
1011+
limit = params.get('limit', 500)
1012+
offset = params.get('offset', 0)
1013+
params['limit'] = int(limit)
1014+
params['offset'] = int(offset)
1015+
request['params'] = params
10161016
return request
10171017

10181018
if error_handling:

0 commit comments

Comments
 (0)