ni / nisystemlink-clients-python

Python API for interacting with a SystemLink Server, created and supported by NI.
https://ni.com/systemlink
MIT License
10 stars 14 forks source link

feat: Add CSV export capability to DataFrameClient #45

Closed kjohn1922 closed 1 year ago

kjohn1922 commented 1 year ago

What does this Pull Request accomplish?

Add export_table_data to the DataFrameClient, which calls the export route on the DataFrame Service API.

Wrap the response.iter_content generator in a file-like object that can either be written to a file or loaded into a pandas dataframe, without loading the data into memory all at once beforehand.

Added an example of writing the export data to a file or pandas.

Why should this Pull Request be merged?

Parity of the python API with new features added to the DataFrame Service API.

What testing has been done?

Manual testing using Jupyter notebooks. Added unit tests for the generator wrapper class. Added an integration test for the export data method.

kjohn1922 commented 1 year ago

I'm working through some type errors.

mure commented 1 year ago

From https://dev.azure.com/ni/DevCentral/_workitems/edit/2347097,

If the server terminates the connection for any reason, the client will get an unhelpful requests.exceptions.ChunkedEncodingError error. It would be nice to catch this and have a more user friendly message.

kjohn1922 commented 1 year ago

From https://dev.azure.com/ni/DevCentral/_workitems/edit/2347097,

If the server terminates the connection for any reason, the client will get an unhelpful requests.exceptions.ChunkedEncodingError error. It would be nice to catch this and have a more user friendly message.

We have a couple of ideas for how to solve this, a couple of which would be changes on the DFS side. I added some details to the bug, and we can decide on the approach when we get to it.