sassoftware / pyviyatools

Python command-line tools that call the SAS Viya REST APIs - for SAS administrators.
Apache License 2.0
38 stars 31 forks source link

All tools should offer JSON output format #9

Open dwstern opened 5 years ago

dwstern commented 5 years ago

Several recent tools (including listcaslibs.py, listcastables.py, listcaslibsandeffectiveaccess.py, listcastablesandeffectiveaccess.py and listgroupsandmembers.py) only output text, in CSV format.

As a general design goal, it would be preferable for all pyviyatools to have at least an option to output JSON rather than text.

Any views on whether one or the other needs to universally be the default? Or are we happy for some to default to JSON, some to CSV text, and so on depending on what job they were developed to do?

Could also split this issue into one per tool, to make tracking completion easier. I haven't yet because that would create a lot of issues and perhaps one is enough.

gerrynelson63 commented 5 years ago

Take a look at the way the printresult function is implemented in sharedfunctions. It currently defaults to json. But it will generically handle "simple", "csv" and "json" as long as it is passed json in the format that the Viya rest api's output. I think this may be as simple as ensuring the individual tools always create json in that format. Currently most already do that (not all) and I think some exceptions are ok.