Skip to content

Commit f275bce

Browse files
authored
Merge pull request #70 from broadinstitute/sn_test
Sn test
2 parents 323beb9 + f9ae13c commit f275bce

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

VERSION.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
11.2.0
2-
- Update logic on how floats and integers are handled when determining a TDR schema from Terra input metadata
1+
11.3.0
2+
- Convert floats back to integers from Terra tables

ops_utils/terra_util.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,11 @@ def _yield_all_entity_metrics(self, entity: str, total_entities_per_page: int =
268268
method=GET,
269269
content_type="application/json"
270270
)
271-
first_page_json = response.json()
271+
raw_text = response.text
272+
first_page_json = json.loads(
273+
raw_text,
274+
parse_float=lambda x: int(float(x)) if float(x).is_integer() else float(x)
275+
)
272276
yield first_page_json
273277
total_pages = first_page_json["resultMetadata"]["filteredPageCount"]
274278
logging.info(
@@ -282,7 +286,12 @@ def _yield_all_entity_metrics(self, entity: str, total_entities_per_page: int =
282286
content_type="application/json",
283287
params={"page": page}
284288
)
285-
yield next_page.json()
289+
raw_text = next_page.text
290+
page_json = json.loads(
291+
raw_text,
292+
parse_float=lambda x: int(float(x)) if float(x).is_integer() else float(x)
293+
)
294+
yield page_json
286295

287296
@staticmethod
288297
def validate_terra_headers_for_tdr_conversion(table_name: str, headers: list[str]) -> None:

0 commit comments

Comments
 (0)