Known Issue: wds-client update breaks TSV exports in notebooks

Post author
Josh Evans

A breaking change has been released for the RecordsApi.get_records_as_tsv() method of the wds-client python package for Terra on Azure. Code using the old method will need to be changed. A full explanation from our engineers is below:

Previously, the RecordsApi.get_records_as_tsv() method returned the name of a temporary file. The file contained the TSV results. Now, the RecordsApi.get_records_as_tsv() method returns the TSV results directly, as a byte array, bypassing the need to read a file. This behavior change is due to a change in openapi-generator, which we use to create the Python client.

Users of the wds-client Python client will need to update code to respond to this breaking change. An example of code that worked previously:

tsv_path = records_api.get_records_as_tsv(...)
with open(tsv_path, 'r') as tsvfile:
    print(tsvfile.readlines())
 

now, the code would be:

tsv_contents = records_api.get_records_as_tsv(...)
print(tsv_contents.decode('utf-8'))
 

alternately, if your code relies on files, you can add a shim to treat the result as a filelike object:

tsv_contents = records_api.get_records_as_tsv(...)
with io.StringIO(tsv_contents.decode('utf-8')) as tsvfile:
    print(tsvfile.readlines())
 

Comments

0 comments

Please sign in to leave a comment.